Actors in Programming

The concept

Steven Curtis


Photo by Kyle Head on Unsplash

In practice Moore’s Law, that single-core processor speeds would double every 18 months is dead. The smaller chips got, the more difficult it became to dissipate that heat and avoid hot-spots on chips.

The solution? We’ve got to a point where you can have thousands of cores on a GPU.

This means we have a Sega-Saturn style problem to manage the concurrency. Those bugs? They’re the cause of confusion in those who are paid to fix the bugs in their code.

It’s time for a new model, and one of them is the actor model.

Rather than getting caught in the weeds for this article we are going to look at this in an abstract sense. This helps since in the model we are introducing in any case the programmer would not know about the environment in which their code runs.

In a multi-core world it makes sense to write code at a higher level of abstraction so it can be adapted at runtime to the current circumstances.

Essentially this is a configuration-based model of computation. We take into account interaction with an open environment.

In this world we are thinking about physics rather than algebra, a model different from the standard Turing machine.

The Actor model

This is a conceptual model which can deal with concurrency in the model computational world.

The Actor Definition

A fundamental unit of computation. It contains:

  • Processing (get something done)
  • Storage (remember things)
  • Communications (send messages)

They are similar in construction to classes in OO programming languages. However, memory can be shared in classes and this is not available to actors. This brings us onto a vital property of actors.

Actors are isolated from each other, and do never share memory. This means that actors have private state (which naturally cannot be modified by other actors.

Actors require an address in order to be sent messages.

Actors are abstract