[Stackless] Re: [Python-Dev] Stackless Design Q.
greg at cosc.canterbury.ac.nz
Thu Feb 21 01:08:01 CET 2002
Christian Tismer <tismer at tismer.com>:
> I'd like to keep track
> of tasklets, since they are now containing vitual
> information about stack state, and I cannot afford
> to loose one of them, or we'll crash.
I'm not sure what the problem is here. A tasklet isn't going to go
away until there are no more references to it anywhere, and once that
happens, there is no longer any way of switching to it.
> So my basic idea was to provide what is needed to get uthreads at
> very high speed, without the ned to use Python for the basic
Well, the higher-level stuff doesn't *have* to be implemented in
Python. But I think it should in principle be possible. Then you can
experiment with different designs for higher-level faciliies in
Python, find out which ones are most useful, and re-code those in C
> My tasklets will also support threading, that is they will become
> auto-scheduled if the user switches this on.
I'm not sure how this is going to interact with the facility for
switching to a specific tasklet. Seems to me that, in the presence of
pre-emptive scheduling, it no longer makes sense to do so, since some
other tasklet could easily get scheduled a moment later. The most you
can do is say "I don't want to run any more now, let some other
tasklet have a go".
So it appears that we already have two distinct layers of
functionality here: a low-level, non-preemptive layer where we
explicitly switch from one tasklet to another, and a higher-level,
preemptive one where we let the scheduler take care of picking what to
These two layers should be clearly separated, with the higher one
built strictly on the facilities provided by the lower one. In
particular, there should be exactly one way of switching between
tasklets, i.e. by calling t.transfer(). Preemptive switching should
be done by some kind of signal or event handler which does this.
> But auto-scheduled frames are a diffeent kind
> of thing than those which are in "waiting for data"
> state. I need to distinguish them or I will crash.
If you get rid of the idea of passing values between tasklets as part
of the switching process, then this distinction disappears. I think
that value-passing and tasklet-switching are orthogonal activities and
would be better decoupled.
Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury, | A citizen of NewZealandCorp, a |
Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. |
greg at cosc.canterbury.ac.nz +--------------------------------------+
Stackless mailing list
Stackless at www.tismer.com
More information about the Stackless