Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As I understand things, asynchronous I/O is not quite the same as non-blocking I/O.</p> <p>In the case of non-blocking I/O, once a file descriptor is setup to be "non-blocking", a <code>read()</code> system call (for instance) will return <code>EWOULDBLOCK</code> (or <code>EAGAIN</code>) if the read operation would block the calling process in order to complete the operation. The system calls <code>select()</code>, <code>poll()</code>, <code>epoll()</code>, etc. are provided so that the process can ask the OS to be told when one or more file descriptors become <em>available</em> for performing some I/O operation.</p> <p>Asynchronous I/O operates by queuing a request for I/O to the file descriptor, tracked independently of the calling process. For a file descriptor that supports asynchronous I/O (raw disk devcies typically), a process can call <code>aio_read()</code> (for instance) to request a number of bytes be read from the file descriptor. The system call returns immediately, whether or not the I/O has completed. Some time later, the process then polls the operating system for the <em>completion</em> of the I/O (that is, buffer is filled with data).</p> <p>A process (single-threaded) that only performs non-blocking I/O will be able to read or write from one file descriptor that is ready for I/O when another is not ready. But the process must still synchronously issue the system calls to perform the I/O to all the ready file descriptors. Whereas, in the asynchronous I/O case, the process is just checking for the completion of the I/O (buffer filled with data). With asynchronous I/O, the OS has the freedom to operate in parallel as much as possible to service the I/O, if it so chooses.</p> <p>With that, are there any wrappers for the POSIX aio_read/write etc. system calls for Python?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload