Start here
IPC families
Byte streams (pipes, TCP, Unix stream sockets) deliver ordered bytes; you must add framing. Shared memory offers the lowest latency bulk path but requires explicit synchronization. Signals are coarse notifications, not a data plane. Higher layers (DBus, Kafka) add naming, policy, and durability.
By the end of this page you should be able to
- Contrast stream IPC vs message boundaries.
- Explain why Unix domain sockets are often used locally instead of TCP loopback.
- Name one capability Unix sockets can pass besides bytes.
Operating systems · Processes
Inter-process communication overview
Pipes, sockets, shm, signals, message queues
TL;DR
IPC mechanisms differ by semantics: byte streams (pipes, TCP), message boundaries (UDP, MQs), shared memory with explicit sync, and asynchronous notifications (signals). The kernel mediates security (permissions, namespaces) and performance (zero-copy paths, splice, sendfile).
Summary
Pick IPC like you pick storage: match durability, ordering, throughput, and failure semantics. OS courses emphasize mechanisms; interviews want tradeoffs and failure modes (backpressure, partial reads, EPIPE).
Diagram
Read the diagram definition
flowchart TB
subgraph kernel[Kernel IPC]
P[pipe/socket buffer]
M[shm + page cache]
end
A[Process A] --> P
B[Process B] --> P
A --> M
B --> MDeeper narrative
IPC spans anonymous pipes, named FIFOs, Unix domain sockets (credentials SCM_RIGHTS), shared memory, signals, and higher-level buses (DBus, Kafka). Pick based on latency, security boundary, ordering, and persistence requirements.
Mechanism (step by step)
Byte-stream IPC
Pipe/socket pair with kernel buffer; natural flow control via blocking.
Shared memory
Map same frames into multiple VAS; requires explicit synchronization.
Message queues / RPC
Kernel or userspace brokers with typed messages and acknowledgements.
Signals
Asynchronous notifications, not a general data plane but coordination primitive.
Key insights
Capability passing
Namespace isolation
Performance ladder
Security boundaries
Did you know?
Common pitfalls
Underspecified message boundaries
Stream sockets need framing; TCP is byte stream not message stream.
SCM_RIGHTS lifetime
Passing fds requires understanding reference counts and CLOEXEC races.
Comparison
IPC snapshot
| Mechanism | Typical use |
|---|---|
| Pipe | Parent/child or sibling processes streaming bytes |
| Unix domain socket | Local RPC with permissions on filesystem path |
| TCP socket | Cross-machine ordered byte stream |
| Shared memory + mutex | High-throughput shared state |
Glossary
UDS
SCM_RIGHTS
memfd
Interview follow-ups
- Why are Unix domain sockets faster than TCP loopback for local IPC?
- How does `memfd_create` relate to IPC?
- What guarantees does POSIX message queue provide vs Kafka?
Callouts
Debugging
`lsof -p PID` reveals IPC endpoints quickly on Linux.
Walkthrough & deep dive
Left: practical “how would I use this?” threads. Right: slower, code-leaning explanations, open one panel at a time so the page does not feel like a wall of sameness.
Walkthrough
Design drill
Deep dive
Broken pipe semantics
Writing to a pipe with no readers raises SIGPIPE/EPIPE, servers must handle client disconnects.
List IPC for a PID
lsof -p $ | head
Self-check
1Unix domain sockets can…
2Pipes provide…
3Signals are weak for IPC because…