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

Re: [rtl] Using RTFifos with multiple writers?



Thu, 14 Dec 2000 Eric Peterson wrote:
> Hi,
>     
>     I'm trying to use RT-Linux (2.2) RT-FIFOs, and I have come up against an
>     apparent limitation with them: they only allow one writer (on the Linux
>     side) to open the FIFO.  I would like multiple processes to be able to
>     open (and write to) a single RT task via a FIFO.  
>     
>     Any suggestions?

There is an inherent implementation/semantics issue with multiple writer FIFOs;
how do you guarantee that data from writers is not mixed up?

	1) Require writers to use a single write() call for data blocks that
	   need to be contiguous.
		- Implementation mess for the "writer sleeps on full buffer"
		  case.
		- Breaks if the writer uses buffered write operations, such as
		  stdio fwrite().
		- Requires some kind of multi-open extension, similar to that
		  used by some sound drivers.
 		- This design is not POSIX compliant...

	2) Design an API extension that deals with multiple writers using some
	   higher level approach than the write() interface.
		- This actually doesn't change anything, except that it doesn't
		  fool users into believing that they're dealing with a POSIX
		  compliant interface.
		- It doesn't even help you much in cleaning up the
		  implementation.

In short, you probably shouldn't use the RT-FIFO interface at all for multiple
writers - sockets or QNX style messages would probably be more right for the
job. Unfortunately, I'm not enough up to date with RTL to point you at
available solutions, but I think there are some.


//David

..- M A I A -------------------------------------------------.
|      Multimedia Application Integration Architecture      |
| A Free/Open Source Plugin API for Professional Multimedia |
`----------------------> http://www.linuxaudiodev.com/maia -'
..- David Olofson -------------------------------------------.
| Audio Hacker - Open Source Advocate - Singer - Songwriter |
`--------------------------------------> david@linuxdj.com -'