The Actor Model
The actor model treats the actor as the universal unit of concurrent computation. Each actor owns private state that no other actor can touch directly. The only way to interact is by sending messages.
When an actor receives a message it can do three things:
- Send a finite number of messages to other actors
- Spawn new actors
- Change its own behavior for the next message it handles
Because state is never shared, there are no locks and no data races inside an actor. Each actor processes its messages one at a time, so its internal logic stays single threaded even while thousands of actors run in parallel.
Messages are delivered asynchronously to a mailbox, a queue the actor drains in order. Senders do not wait for a reply unless they explicitly model a request and response pair. This decoupling lets actor systems scale across cores and even across machines, since a message to a remote actor looks the same as a local one.
The tradeoff is that delivery is usually at most once and ordering guarantees are weak, so designers must handle lost or reordered messages.
Key idea
Actors hold private state and coordinate purely through asynchronous messages, eliminating shared memory races by design.