Shared Memory --- Parallel filters and piping -- Examples Needed

Sven-Ove Westberg sow at cad.luth.se
Tue Feb 23 04:15:56 AEST 1988


In article <11876 at brl-adm.ARPA> rbj at icst-cmr.arpa (Root Boy Jim) writes:
|
|   From: "John S. Robinson" <jsrobin at eneevax.uucp>
|
|   If a programmer has filters filt1, filt2, ... filtn which he wishes to
|   apply in a serial fashion on a stream of data, the process can be accomplished
|   in a trivial fashion by use of a sequence of pipes:
|	   filt1 < <stream> |filt2 |filt3 | ... |filtn > <sink> .
|
|   How does one handle the case where some of the above filters are to be
|   applied in parallel and then be recombined:
|
|It depends on what you mean by `recombined'. Do you want the output of the
|parallel filters in order, or do you want them to run asynchronously,
|mixing their output? BTW, you have two `filt5's in your diagram.
|
|			      filt3
|			     /	    \
|			    /	     \
|   filt1 < <stream> |filt2 /__filt4___+ filt5 | filt6 | ... filtn > <sink> .
|			   \	     /
|			    \	    /
|			     \filt5/
|
|My diagram will look something like this:
|
|   f1 < <stream> | f2 | parallel 'f3' 'f4 -opts' 'f5a' | f5b ...
|

Why not use named pipes? 

With named pipes you can use a standard program f5b, I assume that
f5b reads its input from nfiles the syntax would then be,

f1 < <stream>  | f2 | parallel 'f3' 'f4 -opts' 'f5a' 'f5b' | f6 | .....

If you use named pipes you didn't have too write special versions of f5.
The program parallel forks once for each argument. Function f3 to f5a
is called with it's stdout to p1 p2 ... pn. f5b is called with the
arguments f5b p1 p2 p3 (p=named pipe). The program parallel could be a 
shell script. 


Sven-Ove Westberg, CAD, University of Lulea, S-951 87 Lulea, Sweden.
Tel:     +46-920-91677  (work)                 +46-920-48390  (home)
UUCP:    {uunet,mcvax}!enea!cad.luth.se!sow
Internet: sow at cad.luth.se



More information about the Comp.unix.wizards mailing list