Skip to content
Part IA Lent Term

Why IPC Requires OS Support

The isolation problem

The memory-protection mechanisms that keep processes safe (separate address spaces, MMU-enforced page permissions) also prevent them from sharing data directly. Process A cannot read Process B’s memory because A’s page table has no mapping to B’s physical frames. This is the correct default for security, but it means that processes that need to communicate must go through the kernel.

The kernel as intermediary

The OS provides Inter-Process Communication (IPC) mechanisms as system calls. The kernel acts as a trusted mediator: it can read both processes’ memory (it runs in kernel mode) and can copy data between them, or it can set up shared memory regions that appear in both processes’ address spaces.

Design dimensions of IPC

DimensionQuestions
CapacityHow much data can be transferred in one operation? Bytes? Messages of arbitrary size?
SynchronyDoes the sender block until the receiver reads? Does the receiver block until data arrives?
AddressingHow does a process name the communication partner? Direct (PID) vs indirect (mailbox/pipe name)
RelationshipMust the processes be related (parent-child)?
BufferingIs there a kernel buffer? What is its capacity?

UNIX IPC mechanisms at a glance

MechanismRelated processes?Data unitOrdered?Buffered?
SignalsAny (same UID)One bit + a small integerNo ordering guaranteesNo — signals may be merged
PipesRelated (parent-child, siblings)Byte streamYes, FIFOYes, kernel pipe buffer (~64 KB)
Named pipes (FIFOs)Any (by path name)Byte streamYes, FIFOYes
UNIX-domain socketsAny (by path name)Byte stream or datagramsYes (stream), best-effort (datagram)Yes
Shared memory (shm)Any (by key)Direct memory accessApplication’s responsibilityNone
Message queuesAny (by key)Structured messagesYes, by priorityYes
File descriptors (SCM_RIGHTS)Any (via UNIX-domain socket)File descriptorYesYes

Why not just use files?

Using the file system for IPC (process A writes to a file, process B reads it) is possible but slow: every operation goes through the file-system stack, requires disk I/O (or at least buffer-cache overhead), and incurs the cost of name look-up and permission checks. It also lacks synchronisation — B must poll or use inotify to know when A has written new data. Kernel IPC mechanisms are designed for low-latency, synchronised data transfer without touching the disk.

The Tripos focus

The exam concentrates on three mechanisms: signals (lightweight notification), pipes (byte-stream between related processes), and named pipes (pipes that exist in the file-system namespace, allowing unrelated processes to connect). Shared memory may appear in extension questions, but the core comparison is signals vs pipes vs named pipes.

Summary

  • Process isolation blocks direct data sharing; the kernel must mediate IPC.
  • IPC mechanisms vary in capacity, directionality, synchrony, and addressing.
  • UNIX provides signals (lightweight), pipes (stream, related processes), named pipes (stream, unrelated), sockets, shared memory, and message queues.
  • Signals are unreliable for data transfer; pipes and named pipes are the practical choices for reliable byte-stream communication.