Ann: Stackless Limbo Dancing Works Fine!
Andrew Henshaw
andrew.henshaw at mail.com
Mon May 20 08:48:06 EDT 2002
Christian Tismer wrote:
...snip...
>
>
> /**********************************************************
>
> The central functions of the channel concept.
> A tasklet can either send or receive on a channel.
> A channel has a queue of waiting tasklets.
> They are either all waiting to send or all
> waiting to receive.
> Initially, a channel is in a neutral state.
> The queue is empty, there is no way to
> send or receive without becoming blocked.
>
> Sending 1):
> A tasklet wants to send and there is
> a queued receiving tasklet. The sender puts
> its data into the receiver, unblocks it,
> and inserts it at the top of the runnables.
> The receiver is scheduled.
> Sending 2):
> A tasklet wants to send and there is
> no queued receiving tasklet.
> The sender will become blocked and inserted
> into the queue. The next receiver will
> handle the rest through "Receiving 1)".
> Receiving 1):
> A tasklet wants to receive and there is
> a queued sending tasklet. The receiver takes
> its data from the sender, unblocks it,
> and inserts it at the end of the runnables.
> The receiver continues with no switch.
> Receiving 2):
> A tasklet wants to receive and there is
> no queued sending tasklet.
> The receiver will become blocked and inserted
> into the queue. The next sender will
> handle the rest through "Sending 1)".
> */
>
Just so that I am clear -- in your concept of channels, can channels be
shared among multiple, parallel, sending processes? What about multiple,
parallel, receiving processes? In other words are your channels similar to
the Queue.Queue object?
The reason that I ask is that this is different from Occam's behavior (and
I believe CSP's). In those systems, a channel should be assigned to at
most one concurrent sender and receiver. If you need to merge the output
of multiple processes, then an ALT construct would be used to arbitrate
among the individual channels. Under Occam, sending to the first available
receiver is more complex than in CSP, as it doesn't have ALT output guards
(difficult to implement on distributed processors, I believe); so, I'd
follow the CSP model here.
I suspect you already know all of this, but I thought I would mention it in
case there is some advantage to you in (conceivably) simplifying your
channel design. You can still get the more complex behavior, but it would
be done explicitly.
Andy Henshaw
More information about the Python-list
mailing list