[Stackless] tasklets / greenlets vs. threads / microthreads
tismer at stackless.com
Tue Mar 16 15:37:12 CET 2004
Andy Sy wrote:
> Can someone give a short summary of how tasklets are different from
> microthreads (i.e. what are their pros and cons)? From what I
> remember with playing around with Will Ware's uthreads module a couple
> of years ago, microthreads offer a very similar interface and
> functionality as normal threads (as the name would imply).
> How do tasklets and greenlets compare to threads/microthreads? Can they
> be used for the same things?
Microthreads try to behave like threads. This includes
In Stackless 2.0, tasklets could not do pre-emptive scheduling,
because I had no good criterion when to wllow and forbid it.
In Stackless 3.0 it is possible again, since the non-recursive
interpreter calls give me some measure of an "innocent" state.
Richard Emslie implemented pre-emptive scheduling in the
sprint, and it is of course possible (and a planned task)
to implement microthreads on top of that.
This doesn't mean that I like threads at all, it is just that
people are asking for it. I personally prefer explicit task
switching over implicit, but there are a few applications
which really make sense, for instance, a background task
that automagically saves pickles of a running program,
and yo don't need to change the program for this service.
Tasklets are meant in a way like a simplified subset of
threads, and by design they are chained together into
a circular list for round-robin scheduling.
On the sprint it came up that this is even too much,
and we should have a simpler interface, where tasklets
can be built upon. We had an indea of "corolets", small
coroutine like thingies which just can be switched passsing
Then the greenlets came up. They basically are these
corolets, but they come together with a new way of how to
hard-switch the C stack, and they generalize the problem
of how to soft-switch at the same time.
Yes, greenlets will be the building block for tasklets
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
More information about the Stackless