Interprocess Communication
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
- Processes & ThreadsOperating Systems
Interprocess communication mechanisms exist specifically to work around process memory isolation; you need to understand that isolation before the need for a deliberate communication channel makes sense.
- Stacks & QueuesComputer Science Fundamentals
A pipe is literally a FIFO queue between two processes; the data-structure vocabulary transfers directly to explain its ordering guarantees.
Unlocks
Used in
- Shell pipelines (ls | grep foo) — literally connecting processes via a pipe
- Sockets, which generalize interprocess communication across machines (the foundation networking builds on)
- Message queues and pub/sub systems in distributed architectures
- Shared memory used by high-performance systems that can't afford message-copying overhead
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
- I can explain what a pipe is and how it connects two processes
- I can trace a shell pipeline and explain the data flow between processes
- I can name at least two IPC mechanisms besides pipes and when each is appropriate
- I can explain why sockets generalize naturally from same-machine to cross-machine communication