LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-24-2006, 05:51 AM   #1
George2
Member
 
Registered: Oct 2003
Posts: 354

Rep: Reputation: 30
asynchronized I/O == multiplexing I/O?


Hello everyone,


I always see the two words -- asynchronized I/O and I/O multiplexing. Are they the same thing -- like select/poll?

I noticed that in some situations, people say they are different and asynchronized I/O is better than I/O multiplexing.

Could anyone help to clarify the differences between the two words?


thanks in advance,
George
 
Old 07-24-2006, 08:31 AM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 344Reputation: 344Reputation: 344Reputation: 344
Yes, asynchronous I/O == multiplex I/O.

The terms apply to the same technique, but applied to different contexts. The term "asynchronous I/O" is usually used in device I/O (for example, a hard drive). The term "multiplex I/O" usually applies to a software implementation (for example socket programming).

Same concept, different perspective.
 
Old 07-24-2006, 11:06 AM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
The answer is really "Yes", "No" or "Maybe" ... depending on the context.

"Asynchronous I/O" (not "asynchronized"!) requires kernel support.

On the other hand, "select/poll" (which *appears* to be asynchronous, from the user-space perspective) doesn't.

Both permit multiplexing; only true "asynchronious I/O" can actually increase system throughput (as opposed to perceived responsiveness).

Here are some links on "true asynchronous I/O", for Linux ("aio()" and friends) and Windows (which has "I/O Completion Ports" in Win2k and above):

http://lse.sourceforge.net/io/aio.html
http://www.ixora.com.au/notes/fs_asynchronous_io.htm
http://www.ixora.com.au/notes/raw_asynchronous_io.htm
http://www.codeproject.com/internet/...ableServer.asp

Last edited by paulsm4; 07-24-2006 at 11:08 AM.
 
Old 07-24-2006, 01:05 PM   #4
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Quote:
Originally Posted by George2
Hello everyone,
Could anyone help to clarify the differences between the two words?
Some explanations of these terms:

Asynchronous request processing (of whatever type) means that you can continue doing work after issuing a request for service. This is as opposed to a synchronous request, which doesn't return control to the caller until it finishes fulfilling the request. The purpose of this is to give you some overlap in processing. It works most effectively if you have more than one CPU or an I/O controller that works independently of the CPU (in the case of an I/O request) otherwise you're just splitting your work up into pieces and contending with yourself for CPU cycles. (Even that is not as bad as it sounds- when the CPU is fast enough it enables an OS like Linux to be responsive in an X-Windows environment while you're also running other apps, for example.)

To understand asynchronous I/O from the coder's point of view: you could issue a request for a record from a data base, continue doing some work, and then at a convenient time, check to see if the request has completed.

If you had issued a synchronous request, your code would not go further until the request was completed.

Asynchronous services offer significant performance advantages in multiprocessing configurations (more than one CPU) but the coding is more complicated than using synchronous requests because you have to check to see if the request has completed and deal with errors after they occur.

Multiplexing just means "many into one." I haven't heard it applied to I/O at the API level.

Maybe you meant multithreading? This is how asynchronous I/O typically gets implemented. What it means is that one (or more) work units are assigned to run your program code under, and one (or more) work units are assigned to run your I/O request under. This is the way that the OS manages the job of giving time and other resources to different work on the system. As with asynchronous processing generally, multithreading is nice but it starts to offer significant performance advantages when you have more CPUs to run work under.

Last edited by Randux; 07-24-2006 at 01:12 PM.
 
Old 08-13-2006, 07:10 AM   #5
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Thank you paulsm4,


Quote:
Originally Posted by paulsm4
The answer is really "Yes", "No" or "Maybe" ... depending on the context.

"Asynchronous I/O" (not "asynchronized"!) requires kernel support.

On the other hand, "select/poll" (which *appears* to be asynchronous, from the user-space perspective) doesn't.

Both permit multiplexing; only true "asynchronious I/O" can actually increase system throughput (as opposed to perceived responsiveness).

Here are some links on "true asynchronous I/O", for Linux ("aio()" and friends) and Windows (which has "I/O Completion Ports" in Win2k and above):

http://lse.sourceforge.net/io/aio.html
http://www.ixora.com.au/notes/fs_asynchronous_io.htm
http://www.ixora.com.au/notes/raw_asynchronous_io.htm
http://www.codeproject.com/internet/...ableServer.asp
select is not true asynchronous I/O? How do you make such conclusion -- how select is implemented to be a fake asynchronous I/O? :-)


regards,
George
 
Old 08-13-2006, 07:10 AM   #6
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Hello macemoneta,


Quote:
Originally Posted by macemoneta
Yes, asynchronous I/O == multiplex I/O.

The terms apply to the same technique, but applied to different contexts. The term "asynchronous I/O" is usually used in device I/O (for example, a hard drive). The term "multiplex I/O" usually applies to a software implementation (for example socket programming).

Same concept, different perspective.
What API do you men in Linux is asynchronous I/O? select?


regards,
George
 
Old 08-13-2006, 07:14 AM   #7
George2
Member
 
Registered: Oct 2003
Posts: 354

Original Poster
Rep: Reputation: 30
Thank you Randux,


Quote:
Originally Posted by Randux
Some explanations of these terms:

Asynchronous request processing (of whatever type) means that you can continue doing work after issuing a request for service. This is as opposed to a synchronous request, which doesn't return control to the caller until it finishes fulfilling the request. The purpose of this is to give you some overlap in processing. It works most effectively if you have more than one CPU or an I/O controller that works independently of the CPU (in the case of an I/O request) otherwise you're just splitting your work up into pieces and contending with yourself for CPU cycles. (Even that is not as bad as it sounds- when the CPU is fast enough it enables an OS like Linux to be responsive in an X-Windows environment while you're also running other apps, for example.)

To understand asynchronous I/O from the coder's point of view: you could issue a request for a record from a data base, continue doing some work, and then at a convenient time, check to see if the request has completed.

If you had issued a synchronous request, your code would not go further until the request was completed.

Asynchronous services offer significant performance advantages in multiprocessing configurations (more than one CPU) but the coding is more complicated than using synchronous requests because you have to check to see if the request has completed and deal with errors after they occur.

Multiplexing just means "many into one." I haven't heard it applied to I/O at the API level.

Maybe you meant multithreading? This is how asynchronous I/O typically gets implemented. What it means is that one (or more) work units are assigned to run your program code under, and one (or more) work units are assigned to run your I/O request under. This is the way that the OS manages the job of giving time and other resources to different work on the system. As with asynchronous processing generally, multithreading is nice but it starts to offer significant performance advantages when you have more CPUs to run work under.
Very fruitful answer! Do you mean function like select when you are talking about asynchronous I/O? Any other asynchronous I/O API or libraries?


regards,
George
 
Old 08-13-2006, 11:15 AM   #8
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

The problem is confusion between several (completely different!) meaning of the term "asynchronous".

"Asynchronous" can be a general term; it can also mean something very specific.

In the general sense: "Yes, 'select()' allows you to respond 'asynchronously'".

In the specific sense: "No: 'select()' is not an 'asynchronous' API ... but 'aio_read()' is."

Yes: standard sockets and file streams can be made to read asynchronously (using 'setsockopt()' and 'ioctl()', respectively) ... but this is NOT really an example 'asynchronous I/O'.

Yes, you can multiplex different blocking I/O streams using 'select()', but this isn't really 'asynchronous I/O' (in the specific sense), either.

BOTTOM LINE:
It can mean different things, depending on the context.

This article explains it much better:
http://www.artima.com/articles/io_design_patternsP.html

SUGGESTED TERMINOLOGY:
To avoid confusion, perhaps it might be easier to use this terminology instead:

1) Blocking, or non-blocking synchronous:
select() etc: "standard" I/O; no special kernel support needed

2) Non-blocking asynchronous
aio: a special high-performance technique, supported by Linux and Windows kernels

'Hope that helps .. PSM

Last edited by paulsm4; 08-13-2006 at 11:27 AM.
 
Old 08-13-2006, 04:46 PM   #9
Randux
Senior Member
 
Registered: Feb 2006
Location: Siberia
Distribution: Slackware & Slamd64. What else is there?
Posts: 1,705

Rep: Reputation: 55
Quote:
Originally Posted by George2
Thank you Randux,
Very fruitful answer! Do you mean function like select when you are talking about asynchronous I/O? Any other asynchronous I/O API or libraries?
regards,
George
Sorry, George, I am not knowledgeable about *NIX internals and facilities, so I can't answer your questions. I'm sure other guys here can help.
 
Old 01-26-2007, 07:46 AM   #10
tovis
Member
 
Registered: Jan 2007
Location: Budapest
Distribution: Debian
Posts: 74

Rep: Reputation: 15
exciting exploration

In my opinion asynchron IO != multiplexed IO
When you need multiplexed IO you simply want to be informed about IO events on several IO channels (such as socket, serial or parallel, even file such as fifos, pipes). In other side several asynchron IO could be multiplexed, but multiplexing could not be asynchroned. Another side that all of these things about how to avoid waiting for a specific IO operation and do not missing other, in the same time keep synchronized with every events.
For me today, this discussion is interesting because after progz I can not integrate IO multiplexing, signal handling and timers in convenient way, to keep good modularity of the C code!;o(
First time I simply ignored the signals and timers, use a simple select multiplexer inside the working thread, putting/pulling packets to be read/write into a threadsafe FiFo (exactly a double linked list) and using select's timeout timer to have more or less precise timer. After I'm trying liboop - nice, but does not support threads! In result every time I need to write new code to "low" level communication handling! Seem to be I've should write my own wrapper for these purposes?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
multiplexing multiple audio streams David the H. Linux - Software 1 12-31-2005 01:18 PM
what is a multiplexing server good for? Thinking Programming 4 08-10-2005 02:39 PM
Bandwidth multiplexing russell Linux - Networking 3 04-14-2005 07:11 PM
Multiplexing ADSLs ? michaelsanford Linux - Networking 6 04-14-2005 05:51 PM
client/server multiplexing AquamaN Programming 1 03-25-2004 04:44 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration