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

Christian Tismer tismer@tismer.com
Mon, 19 Mar 2001 14:46:19 +0100


Guido van Rossum wrote:
> 
> > Christian Tismer <tismer@tismer.com>:
> >
> > > But stopping the interpreter is a perfect unwind, and we
> > > can start again from anywhere.
> >
> > Hmmm... Let me see if I have this correct.
> >
> > You can switch from uthread A to uthread B as long
> > as the current depth of interpreter nesting is the
> > same as it was when B was last suspended. It doesn't
> > matter if the interpreter has returned and then
> > been called again, as long as it's at the same
> > level of nesting on the C stack.
> >
> > Is that right? Is that the only restriction?
> 
> I doubt it.  To me (without a lot of context, but knowing ceval.c :-)
> it would make more sense if the requirement was that there were no C
> stack frames involved in B -- only Python frames.

Right. And that is only a dynamic restriction. It does not
matter how and where frames were created, it is just impossible
to jump at a frame that is held by an interpreter on the C stack.
The key to circumvent this (and the advantage of uthreads) is
to not enforce a jump from a nested interpreter, but to initiate
that it will happen. That is, the scheduling interpreter
does the switch, not the nested one.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer@tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net/
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     where do you want to jump today?   http://www.stackless.com/