Multiplexers
Figure 13:
Multiplex processing.
|
If an operation in the pipeline is particularly slow, we may wish to
process the data in parallel. This can be done with a multiplexer,
shown in Figure 13. Together with separate
processing threads it can be used to run any number of processing steps
in parallel. The multiplexer ensures that each `Put' and `Get' from
the corresponding sub-processes match, ensuring that the order of the
data is preserved. The example given bellow creates 3 threads to do
the offset and scaling operation in parallel. Figure
14 shows the structure created, with some slight
simplifications.
DPIFileC<RealT>("in.dat") »= DPMultiplex(3,DPBufferC<RealT>(2) » DPOffsetScale(4.0,2.0) »= DPBufferC<RealT>(2)) »= DPOFileC<RealT>("out.dat");
Figure 14:
Example of multiplexed processing.
|
Normal classes:
Normal functions:
|