[Python-Dev] Stackless Design Q.

Greg Ewing greg@cosc.canterbury.ac.nz
Wed, 20 Feb 2002 16:01:34 +1300 (NZDT)


> Now I am at the point where I'm worst suited for:
> Design an interface.

> Please tell me what you think, and what you'd like
> to change.

It's not clear exactly what you're after here. Are you
trying to define the lowest-level interface upon which
everything else will be built? If so, I think what you
have presented is FAR too complex.

It seems to me you need only two things:

(1) A constructor for new tasklets:

   t = tasklet(f)

      Takes a callable object f of no parameters and returns
      a tasklet which will execute the code of f. The tasklet
      is initially suspended and does not execute any of f's
      code until it is switched to for the first time.

(2) A way of switching to another tasklet:

   t.transfer()

      Suspends the currently-running tasklet and resumes
      tasklet t were it last left off. This will either be
      at the beginning or where it last called the transfer()
      of another tasklet.

All the other stuff you talk about -- passing values between
tasklets, rings of runnable tasklets, scheduling policies, etc --
can all be implemented in Python on top of these primitives.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+