Table of Contents

CSP

CSP (Communicating Sequential Processes) is a model of concurrency, described by C.A.R. Hoare in 1978, where independent processes never share memory at all. Instead, they coordinate purely by sending and receiving messages over channels. There is no mutex to forget to unlock and no shared variable to race on, because there is nothing shared to protect in the first place.

ch := make(chan int)
 
go func() {
    ch <- compute()   // send: blocks until a receiver is ready
}()
 
result := <-ch        // receive: blocks until a sender is ready

Synchronous by default

In the original CSP model, a channel operation is synchronous (unbuffered): a send blocks until a matching receive is ready, and vice versa. This handshake is called a rendezvous, and it means a successful send is itself a synchronization point, the sender knows for a fact the receiver has taken the value, with no separate acknowledgment needed. Many real implementations (Go's channels, for instance) also offer buffered channels that relax this, letting a bounded number of sends complete before a receiver shows up, trading the rendezvous guarantee for reduced blocking.

Where this shows up

Go's goroutines and channels are the most widely used direct descendant of CSP (“share memory by communicating, don't communicate by sharing memory” is the language's own framing of the idea). The model also underlies hardware description languages like occam, which was designed specifically to target CSP-style concurrency on transputer hardware. Compared to mailbox-based message passing, CSP channels are typically anonymous and tied to the specific processes using them, rather than being an addressed, independently-owned queue that any process can send into.