[swift-evolution] [Concurrency] choice of actor model
shams.imam at gmail.com
Fri Aug 18 22:50:57 CDT 2017
Disclaimer: this was work done during my graduate study. It was presented
in front of an audience that included Gul Agha who appreciated the work.
The Actor model is great concurrency model to build on top of thanks to its
data isolation and asynchronous message processing properties. However,
lack of guarantees to control the order in which messages are processed by
an actor makes implementing synchronization and coordination patterns
difficult in the Actor model. Solutions to support such order in processing
constraints may require the actor to buffer messages and resend the
messages to itself until the message is processed. The resulting code is a
petri-dish of code that intertwines both algorithmic logic and
I would encourage you to look into the Selector model which is an extension
of the Actor model that allows an actor to have multiple mailboxes. These
mailboxes can be enabled/disabled to control which message is processed
next by the selector (in many ways this is similar to a select operation
among multiple channels in Communicating Sequential Processes style
programs). Enabling/disabling does not affect which messages are accepted
at a mailbox.
In essence, an actor is a selector with a single mailbox which is always
enabled. Selectors simplify writing of synchronization and coordination
patterns using actors such as:
a) 'synchronous' request-reply,
b) join patterns in streaming applications,
c) supporting priorities in message processing,
d) variants of reader-writer concurrency, and
e) producer-consumer with bounded buffer.
Detailed description: https://shamsimam.github.io/papers/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution