[Python-Dev] uthread strawman

Bill Tutt billtut@microsoft.com
Thu, 9 Nov 2000 16:30:20 -0800

Guido van Rossum [mailto:guido@python.org] wrote:
> > Christian Tismer wrote:
> > > Does anybody know of a useful example where continuations
> > > are really needed? 
> [Bill Tutt]
> > Well, I don't know about needed, but let me explain a possible sever
> > architecture, and then see what new fangled control structure could help
> > become more manageable. (irrespective if the perf #s of such an
> > would actually be worth the architecture overhead in current CPython)
> [...]
> > But it's not clear to me (mostly because I haven't applied a lot of
> > about it) if coroutines would suffice here.

> Indeed, this kind of server architecture is typically done with
> coroutines -- it's not a good argument for the full power of
> continuations. :-)

Hrm, but can I get enough info from the coroutine support to
automatically determine which "work item queue" the paused routine
should go into after the "blocking" operation completes?
Additionally, the coroutine can't be stuck to only one system
thread. That would be bad.

If the above can't be done with coroutines, then I'm either stuck with
an async state machine, or something that might not scale as well as
it could. :(

(Ignoring the interesting discussion about how exactly you make this
architecture portable, since AFAIK only NT lets you bind threads to

I wish I had the time to play with stackless and hack up something
like I mentioned. The performance benefits to async state machine C++ code
use this idea are pretty impressive. CPU cache misses hurt. :(