[Stackless] Stackless based replacement

Andrew Francis andrewfr_ice at yahoo.com
Wed Oct 15 16:17:17 CEST 2008

Hi Larry:

>Is this essentially different from setting up a many-to-one channel, i.e. >a channel which it is illegal for a tasklet to use for input if it is >already "registered" as being used for input by another tasklet?

I don't know about the illegal part.... And maybe my sketch is different in that I don't directly use channels and I am silent on blocking. I guess one of my points is it is fairly easy to write a mechanism that waits for multiple inputs and selects one of them. I just don't feel there is a need to make the mechanism look like a channel. What is trickier (and more interesting) is determining behaviour - i.e., if there is no consumer, should the first producer block? What do other producers do after an input has been selected? 

What is really neat about Stackless Python is with channels, under the hood, it is easy to to prototype synchronization mechanisms.

Another point - when I first started using Stackless Python - my first exercise was to use channels to impose logical orderings on the execution order of tasklets. The naive solution was to have a tasklet wait on multiple channels. I ended up running into deadlock situations. 

I got out of this by being more conscious of stuff like hold-and-wait conditions and simplifying design (mechanisms that use a single channel and counters). Channels are power but you have to be real careful.



More information about the Stackless mailing list