[Stackless] tasklets / greenlets vs. threads / microthreads

Christian Tismer tismer at stackless.com
Wed Mar 17 17:28:28 CET 2004


Andy Sy wrote:

> Christian Tismer wrote:
> 
>>> Are greenlets as general as continuations?
>>
>>
>> What does this question mean, please?
> 
> 
> In the sense that continuations are supposed to
> be able to model all other flow control constructs?

No this is a big difference (and I think this should
go into a FAQ):

Neither tasklets nor greenlets try to add control
structures. This was a design error when implementing
continuations for Python. Python has its control
structures, and we should not invent additional ones.

This is possible by full continuations, but would
make the implementation very capable and at the same time
quite difficult. No big deal for current Python, which
is dynamic like hell, but thinking of future optimizations,
like in the PyPy project, it makes more sense to make
it easy to generate efficient code for the construct.

Another reason is the introduction of hard switching
C stacks in Stackless 2.0. Unless we do a full Stack analysis,
it is impossible to create full continuations from C stack
slices, since you would need to know what it contains.
In order to have just *one* contruct, which can do both
hard and soft switching, it made sense to support the common
possible denominator, which means, continuations are dead,
or in other words, we use one-shot continuations, only.

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at stackless.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/


_______________________________________________
Stackless mailing list
Stackless at stackless.com
http://www.stackless.com/mailman/listinfo/stackless



More information about the Stackless mailing list