Jump to content

Talk:Asynchronous I/O

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by 68.253.58.171 (talk) at 15:38, 11 January 2008 (divided into sections). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Asynchronous vs. Non-blocking

Non-blocking and async are not quite synonyms:

  • Non-blocking refers to using normal I/O primitives in non-blocking mode, e.g. the O_NONBLOCK flag to open(2), where calls to read(2) and write(2) return -1 with errno set to EAGAIN if I/O would block.
  • Async refers to separating checks for the availability of I/O, potentially on many fds, and actually doing the I/O. For example, one may use the O_ASYNC flag to open(2), wait for the kernel to send SIGIO, and then use non-blocking calls to actually do the I/O; or call select(2) with a set of fds to wait for I/O to become available on one of them, then use read(2) and write(2) to do I/O on any fds which have data waiting.
In fact, they are completely different things: nonblocking-I/O is completely synchronous: data is only being transferred to the application dpoing the I/O durign the I/O call, while with asynchronous I/O, the data is actually transferred while the applicaiton does other things. For example, boost asio doesn't do any asynchronous I/O, its fully synchronous (one has to call a asio fucntion to actually do the I/O), while overlapped I/O under e.g. windows is indeed fully asyxnchronous: the function returns immediately and the buffer is filled asynchronously. This is even more important as, programmatically, asynchronous I/O needs very different program structures and usage than non-blocking I/O.
No, during a non-blocking I/O call the data is being transferred to/from an OS buffer. I fail to see how this differs from an asynchronous callback executed when a buffer is full/empty. EdC 23:26, 25 October 2007 (UTC)[reply]

The technique of spawning a thread to block on a single fd each waiting for I/O while the main thread carries on with processing can also be described as async, but does it using blocking calls. Hairy Dude 19:31, 24 May 2006 (UTC)[reply]

That's how the terms are used in C/POSIX. I suspect that some other culture (probably Java?) calls (emulated) asynchronous IO "non-blocking IO" and thus the confusion. Any Java programmers who can enlighten us? --Doc aberdeen 14:13, 27 February 2007 (UTC)[reply]

Windows I/O Completion Ports

Windows I/O Completion Ports seem to be missing from the list. They are similar (pre-date?) to the Solaris Completion Queues, so can go under that sub-heading. See http://www.microsoft.com/technet/sysinternals/information/IoCompletionPorts.mspx and http://msdn2.microsoft.com/en-us/library/aa365198.aspx for more info --Edouard.