Part IA Lent Term
IPC: Summary and Tripos Comparison
The 2019 comparison question (Q4)
The 2019 Tripos asked for a direct comparison of signals, pipes, and named pipes in terms of how easily they support IPC. The mark scheme offers a clear grading:
Signals are the weakest IPC mechanism:
- Asynchronous — the sender does not know if or when the signal was delivered.
- No payload beyond the signal number.
- No synchronisation — the sender’s only feedback is the return value of
kill()(which only confirms the signal was queued, not delivered). - Suitable for notification (“child has terminated”), not for data transfer.
Pipes are substantially more capable:
- Byte-stream data transfer — arbitrary volumes.
- Synchronisation built into the read/write interface (blocking semantics).
- Related processes only (inherited descriptors) — the parent-child relationship is the addressing mechanism.
- Cannot be used between unrelated processes.
Named pipes extend pipes to unrelated processes:
- Exist in the file-system namespace — any process can open by name.
- Same byte-stream semantics as anonymous pipes.
- The file-system entry provides a stable name that survives process lifetimes.
The bigger picture
The evolution from signals → pipes → named pipes → sockets → shared memory traces a path of increasing power and complexity:
| Mechanism | Data | Synchronisation | Addressing | Used for |
|---|---|---|---|---|
| Signals | 1 int | None | By PID | Notification, termination |
| Pipes | Byte stream | Built-in | Parent-child | Shell pipelines, simple IPC |
| Named pipes | Byte stream | Built-in | File path | Client-server (legacy) |
| UNIX sockets | Stream/datagram | Built-in | File path | Local client-server |
| Shared memory | Raw bytes | None (must add) | Key/path | High-throughput data sharing |
Choosing the right mechanism
- Notification (“task done”) → signal.
- Streaming data between shell commands → anonymous pipe.
- Client-server on the same machine → UNIX-domain socket (or named pipe for very simple cases).
- High-throughput bulk data sharing → shared memory + semaphores.
- Cross-network → TCP/UDP sockets.
Summary
- Signals are for notification, not data.
- Pipes are for byte streams between related processes.
- Named pipes are pipes with file-system names for unrelated processes.
- The choice of IPC mechanism depends on the data volume, synchronisation needs, and process relationship.
Past Paper Questions
2019 Paper 2 Question 4(b): Compare UNIX signals, pipes, and named pipes in terms of how easily they support interaction between processes. [6 marks]