Skip to content
IT glossary
ProgrammingUpdated December 3, 2026

Actor model

Модель акторов

A way to organize concurrent software into units called actors. Each actor handles one message at a time and manages its own state; other actors interact with it by sending messages.

Also known as: Akka, Erlang

What is the actor model?

Imagine a chat service that assigns one actor to each room. The room actor owns the list of members. To join a room, another part of the service sends a Join message instead of editing that list directly. The actor decides what the message means and updates its own state. That separation is the key idea: you interact with an actor through messages, not through its internal data.

How actors run

An actor has an address and a behavior that determines how it handles incoming messages. Sending is asynchronous: the sender doesn't wait for the recipient to run its handler. In many runtimes, incoming messages wait in a mailbox. Each actor handles one message at a time, but different actors can run concurrently and may run in parallel. An actor isn't a thread; a runtime can schedule many actors on a shared pool of threads.

While handling a message, an actor can send messages to addresses it knows, create new actors, or decide what behavior to use for the next message. If the sender needs a result, the recipient can send a reply message. There is no ordinary function return from the recipient back to the sender.

Example: a chat room

state: empty set of members

Join(user)       → add user to members
Leave(user)      → remove user from members
Publish(text)    → send text to each current member

The room doesn't run Join and Publish at the same time, so Publish won't see a partially updated member set. But if the two messages come from different senders, whichever gets handled first determines whether the new member receives the text. If a client needs to know it has joined, the room can send an acknowledgment after updating the member set. Sending the request alone doesn't confirm that the join happened.

When it helps, and where it stops helping

Actors fit systems with many independent, long-lived entities, such as chat rooms, game sessions, or device connections. Erlang and Elixir use lightweight BEAM processes with message passing; Akka provides actor APIs for JVM applications. These are ways to build with the model, not synonyms for it.

Serial handling protects an actor's private state, not every workflow that crosses actor boundaries. The model doesn't give you global message ordering, exactly-once delivery, or durable state after a restart. It also doesn't make a busy actor faster: if one room receives messages faster than it can handle them, its mailbox backs up. You still need an overload policy, such as slowing senders down or rejecting work.

What comes up in interviews

A common question is whether actors eliminate race conditions. Distinguish a data race on private state from a timing-dependent outcome in a message protocol. The chat room prevents concurrent writes to its member set, but the order of Join and Publish still affects the result. A stronger answer describes how you'd make the required order explicit, for example by having a client wait for the join acknowledgment before publishing.