Operating Systems6h estimated

Interprocess Communication

Difficulty
Importance

The problem

Processes are deliberately isolated from each other's memory, but real systems are made of multiple cooperating processes that need to exchange data anyway — pipes, sockets, and shared memory are the sanctioned, controlled ways to cross that isolation boundary on purpose.

Why now

Processes and threads established isolation as the whole point of a process; interprocess communication is the deliberate, narrow exception to that isolation — and it needs its own mechanisms because ordinary memory access, which threads use to share data, is exactly what's walled off between processes.

Mental model

If two processes can't share memory directly, they need a shared channel instead — a pipe is a one-way queue between processes, a socket is a two-way channel that can even cross machines, and shared memory is a deliberately punched hole in the isolation wall for when speed matters more than safety.

Requires

Unlocks

Used in

Projects

  • Chain three shell commands with pipes and explain, in terms of file descriptors, what's actually connecting them
  • Write two small programs that communicate over a named pipe or local socket, sending a message from one to the other

Examples

  • ps aux | grep node | wc -l pipes three separate processes' standard output into the next process's standard input
  • A local Redis instance communicates with client processes over a Unix domain socket, a form of interprocess communication

Resources

Mastery checklist