Problem: When actors or tasks alike share objects concurrently they must avoid data races. Locks have serious disadvantages. How can we make data sharing safe without using locks?
Solution: Don't share memory. Instead define an actor that serves the object to its clients. Start it and share the actor link and its interface. Thus you share memory by communicating.
Actors infrastructure libraries which can ease your use of such servers:
- Guards: Actors guarding access to mutable variables and
- GenServers: Abstracting out concurrency to generic servers.