Subject: Re: reading from named pipes
To: None <randy@zyzzyva.com>
From: Danny Boulet <danny@BouletFermat.ab.ca>
List: current-users
Date: 05/11/1995 21:31:46
>   From: Randy Terbush <randy@zyzzyva.com>
>   > 
>   >    I have two processes reading from the same named pipe.
>   >    The output written to the pipe seems to get evenly split
>   >    between the two processes.
>   > 
>   > The wakeup queue is equivalent to a simple round-robin scheduler.  One
>   > process is going to complete a read() and then get stuck back at the
>   > end of the queue.
>   > 
>   >    Feature or bug?
>   > 
>   > More importantly, why is it an issue?
>
>   I have two processes reading from the same pipe. I would like
>   them to each be getting the same information.
>

Unfortunately, depending on your exact requirements, you may find that you
just can't get there from here!

One possible solution is to have a single process reading from the pipe
and have it replicate the data for as many consumers as you've got.

Another one to consider if the producer(s) know that there are exactly
two consumers is to have two different pipes and have the producer do
the replicating.

If the data volume is low then you might try having the producer write
the data into a disk file.  You can then have as many consumers as you
want.  One problem with this approach is that when a consumer reaches
the end of the file, it has to loop checking the file (with short sleeps
or select calls in each iteration) to watch for new data.

-Danny