Common programming practices do not properly address the needs of demanding modern, distributed systems.
Use of actors model allows us to:,
- Enforce encapsulation without resorting to locks.
- Use the model of cooperative entities reacting to signals, changing state, and sending signals to each other to drive the whole application forward.
- Abstracts the execution mechanism that allows retrieving results and resilient.
Actor model resolves the issues with common programming practices by message passing that avoids locking and blocking. Instead of calling methods, actors send messages to each other. Sending a message does not transfer the thread of execution from the sender to the destination. An actor can send a message and continue without blocking. The difference between passing messages and calling methods is that messages have no return value. By sending a message, an actor delegates work to another actor(receiving). The receiving actor delivers the results in a reply message.
Actors execute independently from the senders of a message, and they react to incoming messages sequentially, one at a time. While each actor processes messages sent to it sequentially, different actors work concurrently with each other so that an actor system can process as many messages simultaneously as the hardware will support.
There are no locks used anywhere, and senders are not blocked.