Back to Knowledge Base
programmingNODE: #communicating-sequential-processes

Communicating Sequential Processes (CSP)

A formal language and mathematical theory of concurrency introduced by C.A.R. Hoare in 1978 where concurrent processes interact exclusively via message-passing channels.

AKA:CSP, Hoare's CSP, CSP Model
#programming#concurrency#theory#computer-science#formal-methods

Communicating Sequential Processes (CSP)

Overview

Communicating Sequential Processes (CSP) is a formal language and mathematical process calculus formulated by British computer scientist C.A.R. Hoare in 1978. It describes patterns of interaction in concurrent computing systems.

In CSP, concurrent systems are modeled as autonomous sequential processes that do not share state. Instead, they coordinate and exchange data exclusively through synchronous, first-class channels.

Core Axioms of CSP

  1. Processes: Independent sequential entities that transition through states via events.
  2. Events & Channels: Communication is an event shared simultaneously by both sender and receiver.
  3. Synchronous Rendezvous: In pure CSP, sending on a channel blocks until the receiving process is ready to receive (and vice versa), ensuring mutual agreement and ordering without shared locks.
  4. Alternative / Choice: A process can wait on multiple communication possibilities (the origin of Go’s select statement and Occam’s ALT).

CSP vs Actor Model

While both reject shared memory in favor of message passing:

  • CSP (e.g., Go, Occam, Clojure core.async): Messages are sent to anonymous, typed channels. The sender does not necessarily know the identity of the recipient process. Communication is fundamentally synchronous (unbuffered rendezvous by default).
  • Actor Model (e.g., Erlang/OTP, Akka): Messages are addressed directly to specific Actors (mailboxes). Communication is fundamentally asynchronous by default.

Modern Implementations