Ann: Stackless Limbo Dancing Works Fine!

Fernando Pereira pereira at cis.upenn.edu
Mon May 20 17:14:05 EDT 2002


On 5/20/02 3:51 AM, "Christian Tismer" <tismer at tismer.com> wrote:

> This is where I stumbled. For me, it was only one
> task, waiting for multiple channels. But well, this
> was just a special case of PAR which I saw in LIMBO.
> Limbo has a special case where you wait on an array
> of channels, all for input.
I'm a bit confused here. There is no PAR in Limbo, just ALT

    alt { channel-expr1 => statement1; channel-expr2 => statement2; ... }

The special case you mention is a channel-expression in which the channel is
actually an array of channels of the same type, which is a special case of
the above: perform the channel-expression with the first element of the
array to be ready.
> The more general case has different code for every
> branch, and these code pieces appear to be again
> tiny tasks, right?
I agree that it's overkill to create tasks for all the branches of an ALT,
which would be required in a direct implementation of the Cardelli scheme I
referred to. 
> Since I thought of the special case of one task
> waiting for multiple channels, all in the same
> manner. In the more general case, with a large
> ALT construct, syntactically like a case, I
> expect this is done with as many small tasks,
> together with guards, and then I can imagine
> to arrange these tasks in groups per channel.
In Cardelli's scheme (the first paper I mentioned, not the C# one) ALT and
PAR are implemented in almost the same way. The only difference is that all
the communication requests coming from the guards in the ALT are put in a
mutual exclusion pool. This scheme is very general is that it doesn't assume
single readers or writers on channels, or immediate matching of read and
write requests (thus each channel may have multiple pending reads and writes
queued up).

-- F






More information about the Python-list mailing list