Skip to content

The Actor Model and CSP

In previous chapters, we used tools like mutexes, atomics, and futures to protect shared state and coordinate execution order between threads. However, shared memory with locks is just one paradigm of concurrent programming—another school of thought advocates "don't share memory," using message passing to replace locks.

In this chapter, we dive into two "shared-nothing" concurrency models: the Actor model and CSP (Communicating Sequential Processes). The Actor model, proposed by Carl Hewitt in 1973, organizes concurrency using identified Actors and asynchronous message passing, and has been proven at scale in Erlang and Akka. CSP, proposed by Tony Hoare in 1978, connects independent sequential processes using anonymous channels; Go's goroutine + channel is the classic implementation of CSP.

We will use C++ to implement the core components of an Actor framework (mailbox, message loop, supervisor) and Go-like communication pipelines (buffered/unbuffered, close semantics, select mode) from scratch. We will understand their design motivations and implementation principles, and discuss how to choose the appropriate concurrency abstraction in real-world projects.

Chapter Contents

v0.7.0-9-g940ec1b · 940ec1b · 2026-07-05