On Mon, Jan 24, 2000 at 10:55:00AM -0500, Paul Koning wrote:
> I was doing some code reading in V3.0Pre1 and started wondering about
> the intended usage (as far as multiple accessors goes) of rt fifos.
> The documentation is not particularly clear.  
> 
> Several possible answers come to mind:
> 
> 1. Single reader, single writer per fifo
> 2. Single reader, multiple writers per fifo
> 3. Multiple readers, multiple writers per fifo
> 
> Right now the code looks like major overkill for (1); it appears to
> intend to support (3).  However, as far as I can tell this works
> correctly *only* if the set of readers and the set of writers each do
> NOT contain a mix of Linux and RTLinux threads.  The reason is that
> the Linux fifo I/O functions interlock RTLinux when they pick up the
> pointers, and then again when they update the pointers, but not in
> between.  So it looks like an RTLinux thread and a Linux thread could
> both read the same data, or both write to the same region of an
> rtfifo. 
> 
> I would tend to argue that the ability to mix things like that isn't
> particularly interesting, but if it's not supposed to be done the
> documentation should say that.

Good point.

> A related point: the rtf_get and rtf_put operations lock out
> interrupts for the full duration of the transfer.  You need that to
> get mode (3).  I expect there are plenty of fifos that don't need
> this, they only need (1).  You pay an interrupt latency penalty you
> don't need in that case.  How about another set of calls
> (rtf_get_single?) or a mode setting to select (1) and avoid most or
> all of the interrupt disabling?

The question is whether the time spent during cli is significant and I think
it is not, but perhaps I have not seen something. 


> Finally, I think I could use some additional rtfifo services,
> specifically (a) a way to query how much is currently in the fifo and
> how much space is left, so I can avoid doing an rtf_get or rtf_put
> that will do a partial transfer, (b) a "flush the fifo" operation.
> 
> Reason for (a) is: if you transfer structured data via a fifo (similar 
> to the "frank" sample application) then you don't want to do an
> rtf_get and get less than sizeof (your_struct) coming back.

One useful mode would be a "mailbox" mode where each input output will
be in multiples of message-size.  That would avoid the extra querying 
in the user of the fifo.

IF you can add that efficiently, I'd be happy to take the patch.


-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to