News for hackers. Stuff that matters.
Re:Understanding the code inside Tornado, the asynchronous w... by rdtsc on Saturday May 07, 2011 @03:14PM (#2524342)
> You are calling the syscall "blocking" just because it performs its work inline.

Yes because there is _another_ mode of IO where it doesn't have to do that. So the reason that is called "blocking" is because there is another mode of operation (albeit it is exotic) where the process does not block while performing IO -- the kernel reads/writes the data on behalf of the process. If this second mode of performing IO did not ever exist you could just interchange arbitrarily asynchronous and non-blocking as synonyms.

Since you didn't bother reading the link I posted here is the basic matrix of IO operations:

                    Synchronous            Asynchronous

    Blocking         read/write           select/[e]poll

 
    Non-Blocking    O_NONBLOCK+E_AGAIN      aio_*


There has been talk and various attempt at implementing aio_* style IO for network sockets on Linux, but nothing good so far.

> Even aio_read() performs some work inline (namely enqueing a read request).

Enqueuing the read request is not the same as actually copying gigabytes or terabytes of data from disk where the actual work is performed.

Re:Understanding the code inside Tornado, the asynchronous w... by tptacek on Saturday May 07, 2011 @03:44PM (#2524411)
I think the DeveloperWorks article you've cited is simply wrong, and that's sent you into a tailspin. Select and poll aren't "ways to implement asynchronous blocking I/O".

I think you'll find these links more helpful than the misleading one you've been using.

http://www.circlemud.org/~jelson/software/fusd/docs/node36.h...

http://people.freebsd.org/~hmp/stuff/docs/freebsd_kse.pdf

I could always be wrong about this stuff; maybe I'm the one with the broken semantics. But I'm pretty sure I'm not.

Re:Understanding the code inside Tornado, the asynchronous w... by haberman on Saturday May 07, 2011 @04:01PM (#2524446)
> Since you didn't bother reading the link I posted here is the basic matrix of IO operations.

Actually I did. You are misinterpreting what it is saying. The reason it is calling the select() model "blocking" is because you block during the select(), not because the read() itself is blocking.

This is also non-standard usage: most people wouldn't refer to a select()-based loop as blocking I/O, because a program generally only calls select() when it has nothing else to do but service I/O, so the select() does not "block" the application.