[Stackless] What goes on behind the scenes?
tkjthingone at gmail.com
Sat Jun 20 03:16:59 CEST 2009
Bummer about the docs, though I've tracked down and bookmarked the two
articles mentioned by Andrew.
Also, those three paragraphs on soft switching were very enlightening, thank
you Richard :)
I'll keep plugging away at it, and I'm sure I'll be back at some point in
the future to ask more specific questions!
'till next time, cheers!
On Fri, Jun 19, 2009 at 2:58 PM, Richard Tew <richard.m.tew at gmail.com>wrote:
> On Fri, Jun 19, 2009 at 9:27 PM, Horace Blegg<tkjthingone at gmail.com>
> > Anyway! I'm currently slogging through the source code for stackless as
> > allows (work + school = no free time), and finding it rather interesting.
> Sounds like a good start :-)
> > was wondering if there was another resource other the comments in the
> > and my own knowledge (not excellent) of C that would help me follow
> > stackless's source? (other than lots of time + sheer brainpower, which is
> > current approach)
> I am not sure there is any current and directly relevant documentation.
> > I mainly interested in what happens behind the scenes when someone makes
> > tasklet (or tasklets), what happens while it's running, and how the
> > interpreter/(scheduler?) keeps track of/handles tasklets (if at all?),
> > for an academic/pet project. Expanding my horizons, for lack of a better
> > reason.
> [...hard switching...]
> There is also soft switching, where lower on the call stack a
> dispatcher function waits for an "unwind token" to be returned that
> holds a reference to a Python execution frame. I'm not going to go
> into a lot of detail about how it works, as I don't have much more
> time to work on this email. Soft switching is supposed to be a lot
> faster than hard switching. The code behind the Stackless fork
> includes minimal changes to the Python interpreter itself, but almost
> all of those minimal changes are to support soft switching.
> The stackless module has a chain of tasklets _per Python thread_.
> This is the circular list of tasklets, where one within it is the
> tasklet currently being executed (the "current" tasklet). The thread
> of execution running when the interpreter started up is a special
> tasklet called the "main" tasklet. You can run a scheduler on each
> thread. Channels have special code to allow communication between
> tasklets running on different schedulers in different threads.
> Between channels, tasklets, blocking (using soft and hard switching)
> and the scheduler, this is the core part of the Stackless source code.
> There is of course also the pickling of running code, but that can be
> ignored for the purposes of understanding Stackless for the most part.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Stackless