[Stackless] ALT implementation

Tom Locke tom at livelogix.com
Thu Jan 8 12:36:28 CET 2004

Hi again!

Attached is csp.py, which contains my par and alt implementations, as
well as a trivial test rig.

Seems to all be working ok... 

For alting to work, you have to use AltChan in place of

The alt is fairly mechanically translated from the JCSP implementation,
expect for the use of the wantsToSend flag in the channel. I'm going to
run this by Peter Welch at some point to see if he agrees that the
semantics are right. I had to deviate from JCSP with this one because
I'm working 'outside' the channel communication algorithm. If this stuff
makes it into the stackless core, it should be modified to follow the
JCSP algorithm more closely.

So, after all the waiting, CSP was not a big deal at all. With par and
alt, we're basically there. Of course it would be great to migrate this
stuff into the C codebase - big efficiency wins.

There is a bit still to come:

- Preconditions on alt guards
- Timer guards for the alt

And beyond..?

There's some cool new synchronization primitives, like 'events' and
'buckets'. What are they? I've completely forgotten. Something along the
lines of 'lets all wait for the same event' Like a gun starting a race.

Then there's the way cool graceful termination algorithm. If you do any
semi-serious csp programming, you'll quickly notice how hard it is to
get the damn process network to terminate correctly. Thankfully it's all
been solved, and I've got a nice plan for building it into the library.

Then all we need is a csp oriented networking and gui library... :)


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: csp.py
URL: <http://www.stackless.com/pipermail/stackless/attachments/20040108/7f6ba412/attachment.asc>
-------------- next part --------------
Stackless mailing list
Stackless at stackless.com

More information about the Stackless mailing list