[Stackless] Question of Stackless tasklet?

Christian Tismer tismer at stackless.com
Fri Sep 14 20:54:39 CEST 2007

Hi Zhen,

zhen liu wrote:
>         I've some questions about tasklet in stackless python:
>          1. How tasklet maps to the python thread, and to OS's thread? 
> M:N? or 1:1?

As many tasklets as you like, not related to threads in the first
place, but usually you have many taskletds with one thread.

>          2. IMHO, stackless is just a way to remove the normal thread's 
> stack away and use the heap instead, so, why we need another concept of 
> the tasklet?

That's a distorted picture. Switching pieces of stack to something
else is one way, most of modern Stackless is cooperative, which
is at least 100 times faster than thread switching.

And this is one of the main arguments for using Stackless:
You can really use it to implement certain algorithms. This
is theoretically possible with threads, but nobody would consider
the overhead. With Stackless, you can afford it.

cheers - chris

p.s.: please don't post html to lists.
Christian Tismer             :^)   <mailto:tismer at stackless.com>
tismerysoft GmbH             :     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 802 86 56  mobile +49 173 24 18 776  fax +49 30 80 90 57 05
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
       whom do you want to sponsor today?   http://www.stackless.com/

More information about the Stackless mailing list