[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JCSP - Initial Questions



Dear list members,

Currently I am playing with the JCSP library. I wrote this code that has
a Writer that writes values on channelA, an Incrementer that increments
those values and a Reader that reads them and displays them at the
console:

Code:
public static void main(String[] args) {
    ChannelFactory channelFactory = new StandardChannelFactory();
    One2OneChannel channelA = channelFactory.createOne2One();
    One2OneChannel channelB = channelFactory.createOne2One();
   
    Parallel processPool = new Parallel(
      new CSProcess[] {
          new Writer(channelA.out()),
          new Incrementer(channelA.in(), channelB.out()), 
          new Reader(channelB.in())
      }
    );

    processPool.run();
  }

Questions:
I have the following questions regarding this example:
* The CSProcesses run parallel, but it is unclear how each process gets
its processing time. Maybe the Reader gets much more cycles than the
Writer. Who knows?
* The CSProcesses may be placed in any order. The Incrementer can not
read a value from its input channel when it is not available. How is
this implemented? Is the Incrementer polling channelA? Or send channelA
an event to the Incrementer?
* The nomenclature of channel.in() and channel.out() is confusing.
Channel.out() should be the endpoint of the channel, not the output of
the component where a channel starts. If a channel is a first-class
entity, it should be treated like that.
* The Parallel construct is rigid. Why is it not coupled to some kind of
"parallel" thread pool (or actually a process pool)? The implementation
of above gives all processes (supposedly) the same amount of processing
time in parallel. An "alternative" construct is also allowed. And some
implementing "priorities". That's it. How can I code other process pools
with other policies?
* On rewiring the network the One2OneChannel object has to be replaced
by an Any2OneChannel object or One2AnyChannel object, etc. How can a
process removed easily? There is a Parallel.removeProcess method that
will be executed before a call to run(). The Reader process above reads
continuously from channelB and never stops. How can I swap the Writer
for another in that case? Code after processPool.run() will not be
reached.
* How many threads are there actually? Has every channel, or every
"plug" of a channel their own thread? Or only the CSProcess objects?

Background:
What do I have in mind? I like to develop large-grain dataflow model
where the large-grain processes are aggregations of small-grain
processes (and have a better performance). If such a conversion (from
small to large-grain processes) can be automated, software will
automatically adjust to the amount and type of hardware processors
(multiple CPUs, FPGAs, etc.) 
For that:
* Different CSProcesses should be implemented;
* Those should be swapped for each other easily;
* Those should be compared w.r.t. performance;
* Aggregations of CSProcesses should be compared with the distinct
CSProcesses w.r.t. performance;
* Channels should be plugged somewhere else easily.
Etc. etc.

Thanks a lot in advance for taking time!

Kind regards,

Anne