According to Akka documentation,

” An actor is a container for State, Behavior, a Mailbox, Child Actors and a Supervisor Strategy. “

Let us begin by understanding the need of an Actor Model,

A lot of things have changed in the present scenario. The processes are getting more coarse, This means in order to execute our programs faster we need to use multiple cores which in turn would use multiple threads.

One of the model that helps us to do so is the Actor model.

” The Actor Model provides a higher level of abstraction for writing concurrent and distributed systems. It alleviates the developer from having to deal with explicit locking and thread management, making it easier to write correct concurrent and parallel systems. ”

A very useful approach to achieve concurrency today would be by having Shared Mutable State.

But the problem with this approach can be that, state of a large number of stateful objects can be changed by multiple parts of your application each running in its own thread.

We need objects that can handle non blocking operations and can save the internal state from other operations.

These objects are nothing else but Actors.

An Actor is a computation entity that in response to a message,

can send a finite number of message to other actors.

create a finite number of new actors.

designate their behaviors to be used for the next message it receives.

It gives you:

Simple and high-level abstractions for distribution, concurrency and parallelism.