the blog for developers

Actor Myths

Actors are the new concurrency. They are everywhere. People make bold claims about actors, and while I do not agree with many of them, two in particular I regard as myths. Here they are:

  1. Actors are a shared nothing architecture
  2. Actors are easier to get right because of their shared nothing architecture

I know I’m alone with calling those myths, but here we go. Considering the first myth. If they share nothing, they could not collaborate on data. Sharing immutable messages does not help for getting data synced up again. So this can’t be the way to collaborate. Indeed actors do share everything! Each actor can be considered a data structure with state and a write lock (synchronized in Java).

The second myth. Actors are easier to get right because they share nothing and therefor do not have locks. As argued above they have locks, so this can’t be the reason why they are easier to get right. I consider two characteristics of actors to be the reason for them being easier:

  1. They only can hold one lock at a time (when using synchronized send messages). This is a common approach to prevent deadlocks in locking architectures.
  2. They mostly send asynchronous messages. This prevents the common problems that arise from holding locks and blocking. In locking architectures when accessing locks in an asynchronous way (e.g. with futures and timeouts) there are also no deadlocks for the calling thread.

I would like to learn something from this. So please keep your flaming minimal and help me understand possibles errors in my thinking instead.

Update: If you do not believe me concerning the shared-nothing part, read the example from James

About the author

stephan Stephan Schmidt has been working with internet technologies for the last 20 years. He was head of development, consultant and CTO and is a speaker, author and blog writer. He specializes in organizing and optimizing software development helping companies by increasing productivity with lean software development and agile methodologies. Want to know more? All views are only his own. You can find him on Google +

Discuss on Hacker News Vote on HN