|
From: Erwin de K. <erw...@ph...> - 2006-01-17 12:06:16
|
Hi all,
I am implementing multicast support for YAPI (yes, finally!). The idea is
that you can connect a fifo or a input port of a process network to
multiple consumers. For example:
fifo( id("fifo")),
producer( id("producer"), fifo),
consumer0(id("consumer0"), fifo),
consumer1(id("consumer1"), fifo)
The data that the producer writes to the fifo will be delivered to all
consumers, i.e., all data is seen by all consumers independent of the
order in which they read.
There are many ways to implement this. For the time being I choose to
implement with a separate buffer for each consumer, i.e., each consumer
has its own buffer and separate synchronization with the producer. The
producer copies its data into each of the buffers. Here is an example of
the workload table:
Communication Workload:
-------------------------------------------------------------
| size Tsize Wtokens Wcalls T/W Rtokens Rcalls T/R|
|pc.fifo[0] 128 4 1001 1001 1 1001 1001 1|
|pc.fifo[1] 128 4 1001 1001 1 1001 1001 1|
-------------------------------------------------------------
Each output-input pair behaves as a separate fifo.
Now the question is how a select operation on an output port with multiple
consumers should behave: OR- or AND-semantics? OR-semantics means that the
output port can be selected if one of the consumers request enough data.
AND-semantics means that the output port can be selected if and only if
all consumers request enough data.
Reasons for OR or against AND are:
If you would replace the single output port with multiple output ports and
create point-to-point connections again, the semantics of a select
operation on these outport ports would be OR.
If you would connect an additional consumer, AND-semantics would
potentially influence the behavior of the original producer-consumer pairs
in the sense that the producer would send data only if an additional
condition is satisfied (which may happen later or not at all). This seems
bad for compositionality.
A reason for AND or against OR is:
The select operation on an output port is sometimes used to signal a
commitment from its consumer to consume data. OR-semantics would not give
this commitment from all consumers, so data that is never consumed could
be left in the fifos.
My own opinion is that the semantics should be OR. This is based on the
compositionality argument. With respect to the argument for AND, I think
that the select operation on output ports should not be interpreted as a
commitment from consumers but as a request for an amount of data from
consumers. I think the select operation is typically used for reactive
programming rather than for ensuring that data is not left in fifos (which
is not guaranteed with write/read operations anyway). In this respect, I
think OR is a better choice.
I implemented OR-semantics. It is available in the cvs reposity (cvs
module yapi, cvs tag OR-select). The test example tst/multisel is an
example of select on output with multicast. Feel free to play with it.
Before we release anything, I would like to know if you have strong
opinions for AND-semantics or against OR-semantics. Please let me know.
Best regards,
--Erwin |