I have two processes one C and one python.  The C process spends its time passing data to a named pipe which the python process then reads.  Should be pretty simple and it works fine when I'm passing data (currently a time stamp such as "Mon Aug 19 18:30:59 2013") once per second.
Problems occur when I take out the sleep(1); command in the C process.  When there's no one second delay the communication quickly gets screwed up.  The python process will read more than one message or report that it has read data even though its buffer is empty.  At this point the C process usually bombs.
Before I go posting any sample code I'm wondering if I need to implement some sort of synchronisation on both sides.  Like maybe telling the C process not to write to the fifo if it's not empty?
The C process opens the named pipe write only and the python process opens as read only.
Both processes are intended to be run as loops.  The C process continually reads data as it comes in over a USB port and the python process takes each "message" and parses it before sending it to a SQL Db.
If I'm going to be looking at up to 50 messages per second, will named pipes be able to handle that level of transaction rate?  The size of each transaction is relatively small (20 bytes or so) but the frequency makes me wonder if I should be looking at some other form of inter-process communication such as shared memory?
Any advice appreciated.  I can post code if necessary but at the moment I'm just wondering if I should be syncing between the two processes somehow.
Thanks!
A pipe is a stream. 
The number of write() calls on the sender side does not necessarily need to correspond to the number of read()s on the receiver's side.
Try to implement some sort of synchronisation protocol.
If sending plain text you could do so for example by adding new-lines between each token and make the receiver read up until one of such is found.
Alternatively you could prefix each data sent, with a fixed length number representing the amount of the data to come. The receiver then can parse this format.
Named pipe race condition?