Communicating Sequential Processes
Communicating Sequential Processes, or CSP, is a model where independent processes coordinate by passing values over channels rather than by sharing memory. The slogan is to share memory by communicating instead of communicating by sharing memory.
A channel is a typed conduit. One process writes a value, another reads it. In the classic form the channel is unbuffered, so a send blocks until a matching receive is ready. This handoff is called a rendezvous because both sides meet at the same instant.
Key properties:
- Synchronization A rendezvous synchronizes two processes without any explicit lock.
- Buffering A buffered channel holds a fixed number of values, letting senders run ahead until the buffer fills.
- Selection A select construct lets a process wait on several channels at once and act on whichever is ready first.
CSP underpins languages like Go, where goroutines talk over channels. Because the channel owns the synchronization, programmers reason about message flow rather than about who holds which lock.
The main hazard is deadlock, which happens when every process is blocked waiting to send or receive on a channel nobody will service.
Key idea
CSP processes synchronize by sending values across channels, replacing shared memory locks with explicit message handoffs.