Thread: Pipe

  1. #1
    Registered User
    Join Date
    Jul 2006
    Posts
    22

    Pipe

    Is it possible to have pipe and multiple processes writing into the pipe and another process have to read from the pipe the entire data being written by the writing processes in single read() operation..?

  2. #2
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    275
    I think with a named pipe it is possible. You have to use some synchonization mechanism to avoid read/write errors. The mechanism used are system dependent (i.e, whether you use Windows or any UNIx variant)

  3. #3
    Registered User
    Join Date
    Jul 2006
    Posts
    22
    as per my knowledge fifo manages its own synchronisation for writing to it.
    Issue is one process is writing asynchronously to it at oe end. Other process reading from other end periodically or asynchronuyously.
    Now how this reader will become awar some data is being made available and how mcuh data is available, when that finishes reading

  4. #4
    Just kidding.... fnoyan's Avatar
    Join Date
    Jun 2003
    Location
    Still in the egg
    Posts
    275
    Well, I would create a named mutex object and then hold it until I write something. After the write process was finished, I would release the mutex object which blocks the reader. So the reader is now ready to read from read end of the pipe.

    Honestly, I used such a mechanism in Windows but never used in UNIX.

  5. #5
    Registered User
    Join Date
    Jul 2006
    Posts
    22
    i will also this method with 2 related processes or wwith threads. But in this case of fifo.My processes may not be related. So how i will come to know which process when is holding mutex.
    Can i do sth with fcntl system call. Has anyone done such work?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. cont of IPC using PIPE
    By BMathis in forum C Programming
    Replies: 1
    Last Post: 03-15-2009, 05:16 PM
  2. Pipe class.
    By eXeCuTeR in forum Linux Programming
    Replies: 8
    Last Post: 08-21-2008, 03:44 AM
  3. Named pipe problem
    By rahul_c in forum C Programming
    Replies: 3
    Last Post: 10-02-2007, 05:40 PM
  4. Pipe(): Interprocess or Intraprocess comm?
    By @nthony in forum C Programming
    Replies: 2
    Last Post: 03-28-2007, 07:27 PM
  5. Having trouble with a named pipe
    By crazeinc in forum C Programming
    Replies: 2
    Last Post: 05-13-2005, 01:00 AM