Tue Mar 10 14:47:23 CET 2009
coroutines and "join"
Start with a simple 2-coroutine network: a process coupled to a
| | --> | |
| C | | P |
| | <-- | |
The controller's outputs are the process' inputs, and vice versa.
This can be executed using synchronized channels (a read is woken up
by the write on the other end).
1. This can be implemented using globaly named variables and globally
accessible synchronization events (signal/wait). A disadvantage
here is that to name such a variable "input" or "output" is
2. The ambiuitiy can be removed by introducing "positive" and
"negative" coroutines. Negative routines read from "output" and
write to "input". It is natural to call these negative coroutines
3. Coroutines with multiple inputs that are read at the same time need
a synchronization mechanism. This is usually called "join": a
process that continues when all its inputs are available. (aka a
It is possible to avoid "join" by buffering all "output" registers
(bus task read channels) in one direction and adding explicit clocks
that only occur when all data is guaranteed ready. This basically
clocks the "input" -> "output" state machines.
Another question is:
Given a "signed" network of coroutines (every corotine is connected
only to coroutines of opposite polarity) is it sufficient to start
the even ones in output and the odd ones in input (or vice versa) to