[Stackless] Re: Questions

Christian Tismer tismer at tismer.com
Wed Aug 20 20:00:45 CEST 2003


Hi Richard,

> I had some specific questions I had built while playing around with
> auto scheduling.
> 
> 1. The first one is in scheduler.py - where I marked xxx.  It would appear
> that channels became cleared if we got back to main, and then run(...)
> again.  I haven't investigated this in the code, but wondered if it was a
> design decision, oversight or you were somehow forced into doing this?

As a side note: You should avoid to give your tasklet
a property named "tasklet", since this is a type name.
Furthermore, I'd suggest to derive MyTasklet from tasklet.

On channels: No, they should not get cleared.
I'm not sure whether I did such a thing on
disposal of the thread state.
Are you using PythonWin? Maybe there it happens,
since it re-creates a new tstate all the time, and I have
nothing to lean on, yet :-)

> 2.  Was there any thing blaringly stupid/wrong in my preempt() function.
> I noticed that if I would drop the "slice" instructions too low, it would
> seg fault.  I found debugging this hard, that was why I was going to add
> the shared memory segment to watch thread state / tasklets in realtime
> (maybe with a sleep between opcodes!)

I had a closer look, and didn't find any bugs, yet.
It looks pretty well. Maybe there is any condition
that this code may not come between certain opcodes,
I don't know.

I think to merge your changes into Stackless now,
preliminarily, and do some testing.
When it is stable, we can change it to the desired
interface, and right now just don't tell people
about the autoschedule flag.

> 3.  A more general question was what are these non-recursive
> implementations of methods/functions - I couldn't really figure out what
> they were about.  Maybe the question is what do you mean by recursion
> here?

The non-recursive implementations are the heart
and the hard stuff of Stackless 3.0.
These functions try to switch tasks without
changing the C stack. That is, they must finish the
current interpreter, put something on the frame stack,
and cause to be called later.

Let's stick with the brute force things (SLP 2.0) for
the moment, the other thing is very hard to explain.
(Maybe you want to look at schedule_nr. This is
programming by jumping backwards out of the window).

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at tismer.com>
Mission Impossible 5oftware  :     Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a     :    *Starship* http://starship.python.net/
14109 Berlin                 :     PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34  home +49 30 802 86 56  mobile +49 173 24 18 776
PGP 0x57F3BF04       9064 F4E1 D754 C2FF 1619  305B C09C 5A3B 57F3 BF04
      whom do you want to sponsor today?   http://www.stackless.com/

_______________________________________________
Stackless mailing list
Stackless at www.tismer.com
http://www.tismer.com/mailman/listinfo/stackless




More information about the Stackless mailing list