[Python-Dev] microthreading vs. async io (original) (raw)

"Martin v. Löwis" martin at v.loewis.de
Thu Feb 15 08:39:59 CET 2007


dustin at v.igoro.us schrieb:

Asyncore only implements asynchronous IO -- any "tasks" performed in its context are the direct result of an IO operation, so it's hard to say it implements cooperative multitasking (and Josiah can correct me if I'm wrong, but I don't think it intends to).

I'm trying to correct you: By your definition, asyncore implements cooperative multi-tasking. You didn't define 'task', but I understand it as 'separate activity'. With asyncore, you can, for example, run a web server and an IRC server in a single thread, as separate tasks, and asyncore deals with the scheduling between these tasks. In your terminology, it is based on continuations: the chunk you specify is the event handler.

Indeed, asyncore's doc string starts with

There are only two ways to have a program on a single

processor do "more than one thing at a time".

and goes on suggesting that asyncore provides one of them.

Regards, Martin



More information about the Python-Dev mailing list