Shared State for Actors: Pass-By-Replication Semantics
The actor model prevents the traditional pitfalls of concurrent programming (deadlocks and data-races) by not allowing shared state between different processes. While shared state can be simulated through a set of message exchanges, this quickly becomes complex and renders the program inexpressive. In this paper we present a novel way of integrating shared state into the communicating event-loop model by introducing a new type of object called a repliq. When such object crosses actor boundaries it exhibits what we call pass-by-replication semantics. The object is deeply copied and the runtime keeps track of the owner of the original repliq, the actor that first created it. Actors can access and alter repliq objects locally, while the runtime makes sure they are eventually consistent with other replicas of the object. Consistency is guaranteed by eventually executing all the operations of the replicas in the same order, as determined by the original object. Synchronization happens in a background process and external updates become visible in between message processing. This makes sure that the programmer’s code is always executed in a consistent snapshot of the object states. We present the semantics, guarantees and restrictions exhibited by repliq objects using an implementation in the AmbientTalk actor language. This model maintains the easy and safe local-only execution model for the programmer that is key to the actor model, while providing integrated and expressive means to share state that is eventually consistent.
(AGERESPLASH_2016_paper_12.pdf) | 1.24MiB |
slides (pass-by-replication_AGERE2016.pdf) | 1.32MiB |