Preemptive Multithreading by using Continuations
Mike C. Fletcher
mcfletch at rogers.com
Fri Dec 27 18:23:25 EST 2002
I think Guido _was_ interested in seeing a pre-emptive (portable)
micro-threading system built using the current Python around the 2.2.0
time-frame (though not generators specifically (and he seems to dislike
continuations) IIRC), not sure if that interest ever went anywhere (I'm
assuming no, given that I haven't heard about it since). IIRC the
discussion was over on python-dev cross-posted to the stackless list, so
you could troll the archives of either for it.
Your approach is funky (pushing all processing into signal handlers). I
wouldn't have thought of doing that (I thought signal handlers froze the
CPU in their code (including blocking all system threads) until they
were finished). Out of curiosity, does the approach also pre-empt C code
(I would think it would)?
Anyway, interesting hack. I wouldn't call what you're using
"continuations" (at least not first-class ones such as you saw in
Stackless 1.0), though I suppose the OS's signal-handling machinery
could be considered a stack of open continuations. Have fun,
Mike
Dominic wrote:
> Python continuations can easily be used for
> cooperative threading.
>
> But has anyone tried to implement
> preemptive threading by using continuations?
...
> So my question is: Has anyone
> tried or implemented a decent
> (well, everything that is better than
> my hack ;-)
> microthreading package for
> standard python?
...
_______________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://members.rogers.com/mcfletch/
More information about the Python-list
mailing list