/ˈæktər ˈmɑːdəl/

noun … “Concurrency through isolated, communicating actors.”

Actor Model is a conceptual model for designing concurrent and distributed systems in which independent computational entities, called actors, communicate exclusively through asynchronous message passing. Each actor encapsulates its own state and behavior, processes incoming messages sequentially, and can create new actors, send messages, or modify its internal state. This model eliminates shared mutable state, reducing the complexity and risks of traditional multithreaded Concurrency.

Key characteristics of the Actor Model include:

  • Isolation: actors do not share memory, preventing race conditions and synchronization issues.
  • Asynchronous messaging: actors interact via message queues, allowing non-blocking communication.
  • Scalability: the model naturally supports distributed and parallel computation across multiple CPUs or nodes.
  • Dynamic behavior: actors can change behavior at runtime and spawn other actors to handle tasks concurrently.

Workflow example: In a system built with Scala and the Akka framework, actors can perform internal computations without network operations, demonstrating the principles of isolation and asynchronous messaging safely on the same host.

import akka.actor._

class CounterActor extends Actor {
  var count = 0
  def receive = {
    case "increment" => count += 1
    case "get" => sender() ! count
  }
}

val system = ActorSystem("LocalSystem")
val counter = system.actorOf(Props[CounterActor], "counter")
counter ! "increment"
counter ! "increment"
counter ! "get"

Conceptually, the Actor Model is like a network of isolated mailboxes. Each mailbox (actor) processes incoming letters (messages) in order, decides actions independently, and can send new letters to other mailboxes. This structure allows the system to scale and respond efficiently without conflicts from shared resources.

See Concurrency, Scala, Threading, Akka.