uthreads and context-switching (was Re: Erlang)

Aahz Maruch aahz at panix.com
Thu Dec 28 13:03:16 EST 2000


In article <86wvckqw4h.fsf at localhost.my.domain>,
Brad Knotwell  <knotwell at ix.netcom.com> wrote:
>
>I'm now wondering if Stackless Python's uthreads are cooperatively or
>pre-emptively multi-tasked.

Both.  :-/  That is, I believe it's pre-emptively multi-tasked in the
sense that threads do not explicitly yield up control, but it's
cooperative in the sense that the context-switch can only occur between
byte-codes, so a blocking I/O call will prevent context-switching.

If you put the blocking I/O into Python threads (which are OS-level
threads and therefore definitely pre-emptive), that might be a good way
of handling uthreads.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Ninth Virtual Anniversary: 3 days and counting



More information about the Python-list mailing list