Chapter 13Programming with Actors

We often use multithreading and concurrency when programming complex, time-consuming applications, to improve the response time or performance. Traditional concurrency solutions, sadly, lead to several issues, such as thread safety, race conditions, deadlocks, livelocks, and hard-to-read error prone code. Shared mutability is the number-one culprit.

Avoid shared mutability and you’ve removed so many issues. But how to avoid it? That’s where actors come in. Actors help to turn shared mutability into isolated mutability. Actors are active objects that guarantee mutual exclusion of access. No two threads will ever work on an actor at the same time. Due to this natural self-imposed mutual exclusion, any data stored ...

Get Pragmatic Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.