Fake threads (was [Python-Dev] ActiveState & fork & Perl)
Guido van Rossum
Mon, 05 Jul 1999 08:06:03 -0400
> > ... Full continuations
> > cannot be expressed by coroutines. All the rest is true.
> I beg enlightenment from someone more familiar with these
> high-falutin' concepts. Would the following characterization be
> All these beasts (continuations, coroutines, generators) involve the
> idea of "resumable", but:
> A generator's state is wholly self-contained
> A coroutines's state is not necessarily self-contained but it is stable
> Continuations may have volatile state.
> Is this right, wrong, necessary, sufficient...??
I still don't understand all of this (I have not much of an idea of
what Christian's search for hidden registers is about and what kind of
analysis he needs) but I think of continuations as requiring
(theoretically) coping the current stack (to and from), while
generators and coroutines just need their own piece of stack set aside.
The difference between any of these and threads (fake or real) is that
they pass control explicitly, while threads (typically) presume
pre-emptive scheduling, i.e. they make independent parallel progress
without explicit synchronization. (Hmm, how do you do this with fake
threads? Or are these only required to switch whenever you touch a
I'm not sure if there's much of a difference between generators and
coroutines -- it seems just the termination convention. (Hmm...
would/should a generator be able to raise an exception in its caller?
--Guido van Rossum (home page: http://www.python.org/~guido/)