← Interview Prep

Linux Kernel — Process Communication (IPC)

How processes exchange data and coordinate: pipes/FIFOs, Unix-domain sockets (fd passing), shared memory (fastest, you own the locking), message queues, semaphores, signals and eventfd; System V vs POSIX APIs, the futex, and choosing the right mechanism.

How separate processes — isolated by design — exchange data and coordinate. There are several mechanisms; the interview skill is picking the right one and knowing its trade-offs. Original, interview-focused notes.

Two questions decide the mechanism: do you need to move a stream of bytes, share a region of memory, or just signal/synchronize? And do the processes share a parent, a machine, or neither?

The mechanisms

MechanismShapeNotes
PipeUnidirectional byte streamBetween related processes (shell |). Anonymous; kernel-buffered; blocks when full/empty.
FIFO (named pipe)Byte stream via a filesystem nameLets unrelated processes connect (mkfifo).
Unix-domain socketStream or datagram, bidirectionalLocal sockets; can pass fds and credentials (SCM_RIGHTS) — the modern, flexible choice.
Shared memoryA shared memory regionFastest — no copy through the kernel; but you must synchronize access.
Message queueDiscrete messages, prioritizedMessage boundaries preserved (unlike a byte stream).
SemaphoreCounter for synchronizationGuards access to a shared resource (often paired with shared memory).
SignalA single async notificationMinimal data; see Signals.
eventfd / pipe self-notifyA wakeup fdIntegrates cleanly with epoll event loops.

Shared memory — fastest, but you own the locking

SysV vs POSIX

Choosing

Likely interview questions

Kernel Internals series. Related: Signals · Synchronization · Processes.