Difference between Pipe and Fifo

Pipe and Fifo both are IPC (Inter Process Communication) object.

Pipe (IPC Object)

  • Pipe does not have any name unlike Fifo.
  • Pipe is a structure of data which is contained into the memory. It is removed when existing process terminates.
  • Basically, Pipe is used to communicate between 2 or more related processes.
  • If Pipe is already in opened state, then it does not need to be opened.
  • Pipe provides simplex data flow
  • eg: pipe(int fd[2])

Fifo (IPC Object)

  • Fifo is also an IPC object, but it has its name.
  • Unlike Pipe, it is a structure of file which is created in disc.
  • It is also used for communication but only between unrelated processes.
  • It should be opened every time when it needs to write and read.
  • Fifo provides half duplex data flow.
  • eg: mkfifo(const char * path_name, mode_t mode)

Comments