Stackless Python, eventual merge?

Christian Tismer tismer at
Wed Sep 18 11:42:45 EDT 2002

Oren Tirosh wrote:

>>Just-need-an-idea-how-to-determine-that - ly y'rs - chris
> Who says you have to determine that in advance? Just try. If the
> extension actually calls the interpreter recusively it means that it
> needs its own stack.  Let it have exclusive ownership of the current OS
> thread and its associated stack and allocate another thread from a
> dynamic thread pool to continue tasklet scheduling. When the extension
> returns back to nesting level 0 its thread will be released back into
> the pool. This way a relatively small pool of OS threads can be used to
> juggle a much larger pool of tasklets.

This is of course an interesting idea.
The reason why I thought I need to determine in advance
is that I don't know when a new extension shows up on
my stack. But when this happens, bazillions of tasklets
may have been created already, and they have live cstack
objects, which cannot be relocated (at least not in the near
future). So they do need to use this one stack again.

> This can also be a good way to handle extensions that make blocking I/O
> calls like database engines - a relatively small pool of OS threads can
> serve requests from a bigger pool of tasklets. This can be transparent:
> when the number of concurrent requests exceeds the number of threads any
> new request frames can be queued until a thread becomes available. The
> level of concurrency for any resource can be tuned dynamically to
> optimize the performance without affecting the overall structure of the
> program.

Sure, that's a thing I definately will do, if I can find
a good solution to the other problem above.

ciao - chris

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

More information about the Python-list mailing list