[Python-Dev] Re: [Stackless] comments on PEP 219

Tim Peters tim.one@home.com
Wed, 14 Mar 2001 01:21:57 -0500


[Greg Ewing]
> If I have to use real threads to get my uthreads to work
> properly, there doesn't seem to be much point in using
> uthreads to begin with.
> ...
> Microthreads should *free* one from all that nonsense. They
> should be simple, straightforward, easy to use, and bulletproof.
> Instead it seems they're going to be just as tricky to use
> properly, only in different ways.

Stackless uthreads don't exist to free you from nonsense, they exist because
they're much lighter than OS-level threads.  You can have many more of them
and context switching is much quicker.  Part of the price is that they're not
as flexible as OS-level threads:  because they get no support at all from the
OS, they have no way to deal with the way C (or any other language) uses the
HW stack (from where most of the odd-sounding restrictions derive).

One thing that impressed me at the Python Conference last week was how many
of the talks I attended presented work that relied on, or was in the process
of moving to, Stackless.  This stuff has *very* enthused users!  Unsure how
many rely on uthreads vs how many on coroutines (Stackless wasn't the focus
of any these talks), but they're the same deal wrt restrictions.

BTW, I don't know of a coroutine facility in any x-platform language that
plays nicely (in the sense of not imposing mounds of implementation-derived
restrictions) across foreign-language boundaries.  If you do, let's get a
reference so we can rip off their secrets.

uthreads-are-much-easier-to-provide-in-an-os-than-in-a-language-ly
    y'rs  - tim