[Stackless] preemptive tasklet scheduling in stock python 2.4

Jeff Senn senn at maya.com
Fri Feb 11 18:06:38 CET 2005


Hello folks-

Knowing the Christian is way-busy and pondering how I was
going to get tasklet auto-scheduling in that spiffy new
Python 2.4... and knowing about Armin's greenlet extension...
it occurred to me that I don't actually need to modify any
core Python!

With only a small change to greenlet.c (as well as a bug
fix involving tstate->recursion_depth) I am now able to
implement a "preemptive" tasklet scheduler in Python.

Caveats (also check existing greenlet "bugs" e.g. thread-safety):

  -- mostly useful for scheduling pure-python tasklets
    within one OS thread (use of C extensions in tasklets
    left as an exercise...)

  -- *probably* not as fast as any of the stackless-python
    variants (though I haven't done much profiling).

  -- hardly any testing done (only tested on OS-X, python 2.4)

and (the most revealing: <wink> <wink>)

  -- incompatible with the python debugger (or anything
    else that uses the trace functions! Ah ha!)

-Jas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: greenlet-jas.tgz
Type: application/x-gzip
Size: 92160 bytes
Desc: not available
URL: <http://www.stackless.com/pipermail/stackless/attachments/20050211/6e56af13/attachment.bin>
-------------- next part --------------



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


More information about the Stackless mailing list