Summary of threading for experienced non-Python programmers?

Diez B. Roggisch deets at nospam.web.de
Tue Apr 1 19:26:52 EDT 2008


> I believe you stil misunderstand.  The select module doesn't provide
> an inteface to aio(3).  It provides an interface to select() and
> poll() system calls, which don't provide asynchronous access to
> regular files.

I never claimed it provided access to aio. In the thread with Paul 
Rubin, it was clarified that there is the distinction made between 
blocking and non-blocknig async calls. Which you didn't mention.

Don't get me wrong: I appreciate the mentioning of aio (didn't know 
about it beforehand) and don't dispute it's superiority. But that 
doesn't change that one is not forced to use threading in python (which 
can become very expensive) to deal with mulitple I/O streams asynchronously.

>> So if I were in nitpicking-mood, your assertion still would be false
> 
> I invite constructive nitpicking, but you are completely missing the
> point.  You are confusing aio(3) with select and poll.


I didn't confuse anything. You didn't _mention_ aio, and I didn't even 
know it...

>> I'm pretty sure though that tiwsted & asynchore don't poll, but
>> instead use the select-module. Which at least for unix (and AFAIK
>> for Windows as well) is asynchronous - you get notified if data
>> arrives or has been transmitted, and otherwise your process sleeps.
> 
> Unfortunately, this is not the case for files at all, even on Unix.
> (On Windows, select doesn't work on files at all, it only accepts
> sockets.)

AFAIK select is used in cases where e.g. several processes are piped 
together to prevent blocking. Your usecase with a deliberately distorted 
file-server is sure relevant for certain usecases - but I don't think it 
qualifies as "not at all, even on Unix".

To reiterate what my post was actually after: I understood it as if you 
didn't acknowledge the asynchronous capabilities of python which are 
used by widely known & successfully adopted built-in modules or 
3rd-party-extensions - without resorting to C, and without forcing 
threads upon the users.

It did *not* say that it supports every existing, more powerful and 
generally better asynchronous mechanism supported by any OS out there. 
Even though it would certainly be nice if it did :)


Diez



More information about the Python-list mailing list