The Actor Model describes a form of Concurrent Programming used in Erlang/Elixir.

The Actor Model is based on processes that are:

  • discreet units of computation
  • strongly isolated (own memory)
  • lightweight

The processes then use messages to communicate:

  • This is how data is copied from one process to another
  • It arrives in a per process mailbox
  • Messages are handled sequentially (in order of arrival)

It is similar to Object Oriented Programming where instead of passing messages, method calls are used. The major difference is that in Object-oriented systems there is not the isolation of a process, instead Threading etc is used. Also processes do not have inheritance - but other patterns can be used to share behaviour.

Because process have strong isolation (no shared state), sequential processing (meaning garaunteed order) and are independent of one another (can crash without affecting others) it gives us the ability to execute concurrently using these strong primitives.

Issues that can be faced:

  • Unexpected termination of processes
  • Unexpected empty mailbox
  • Unexpected new messages

but these can be mitigated with retries, etc.