Pipes and Named Pipes (FIFOs)

Why Separate Processes Need a Deliberate Way to Communicate

Unlike threads within the same process (covered earlier in this section), which naturally share memory, separate processes each have their own protected, isolated memory space by design. Inter-Process Communication (IPC) mechanisms exist specifically to let genuinely separate processes exchange data safely.

Pipes: A One-Way Data Stream Between Related Processes

Process A  ---- writes to pipe ---->  [ Pipe buffer ]  ---- Process B reads from pipe

A pipe is a unidirectional communication channel, typically connecting two related processes - usually a parent and its child. Data written by one process is read by the other, in strict first-in-first-out order, similar in spirit to the shell command pipeline pattern (like command1 | command2).

Why Ordinary Pipes Have Real Limitations

  • They only work between related processes (typically a parent and child sharing a common ancestor).
  • They only exist temporarily, disappearing once the related processes finish.
  • They only support one-directional flow at a time.

Named Pipes (FIFOs): Removing the "Related Processes Only" Restriction

A named pipe (also called a FIFO) exists as an actual named entity, addressable independently of any specific parent-child relationship - completely unrelated processes can open and use the same named pipe, as long as they both know its name, removing the key limitation of an ordinary pipe.

Ordinary Pipes vs Named Pipes

Ordinary PipeNamed Pipe (FIFO)
Who can use itOnly related processes (e.g. parent/child)Any processes that know its name
LifetimeExists only while the related processes existCan persist independently, like a file

Why Pipes Remain a Widely Used IPC Mechanism

Despite their simplicity, pipes are extremely efficient for straightforward, sequential data streaming between processes - which is exactly why they remain a foundational building block in command-line environments and simple process-to-process data pipelines today.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.