December14,2009Page
2
of42
Actor Model
i
ActorScript is based on
a mathematical model of computation
that treats “
Actors
”
as the universal primitivesof concurrent digital computation [Hewitt, Bishop, andSteiger 1973; Hewitt 1977]. Actors been used both as aframework for a theoretical understanding of concurrency,and as the theoretical basis for several practicalimplementations of concurrent systems.Unlike previous models of computation, the Actor modelwas inspired by physical laws. It was also influenced bythe programming languages Lisp [McCarthy
et. al.
1962],Simula[Dahl and Nygaard 1967] and Smalltalk-72 [Kay1975], as well as ideas for Petri Nets [Petri 1962],capability-based systems [Dennis and van Horn 1966] andpacket switching [Baran 1964]. Its development was
“
motivated by the prospect of highly parallel computingmachines consisting of dozens, hundreds or even thousandsof independent microprocessors, each with its own localmemory and communications processor, communicatingvia a high-performance communications network
.”
[Clinger 1981] Since that time, the advent of massiveconcurrency through client-cloud computing and many-core computer architectures has rekindled interest in theActor model [Hewitt 2009b].
Fundamental concepts
An Actor is a computational entity that, in response to amessage it receives, can concurrently:
send a finite number of messages to other Actors;
create a finite number of new Actors;
designate the behavior to be used for the nextmessage it receives.There is no assumed sequence to the above actions andthey could be carried out concurrently.Decoupling the sender from communications sent was afundamental advance of the Actor model enablingasynchronous communication and control structures aspatterns of passing messages [Hewitt 1977].An Actor can only communicate with Actors to which it isconnected. It can directly obtain information only fromother Actors to which it is directly connected. Connectionscan be implemented in a variety of ways:
direct physical attachment
memory or disk addresses
network addresses
email addressesThe Actor model is characterized by inherent concurrencyof computation within and among Actors, dynamiccreation of Actors, inclusion of Actor addresses inmessages, and interaction only through directasynchronous message passing with no restriction onmessage arrival order.
Illustrations
The Actor model can be used as a framework formodeling, understanding, and reasoning about, a widerange of concurrent systems. For example:
Electronic mail (e-mail) can be modeled as anActor system. Accounts are modeled as Actorsand email addresses as Actor addresses.
Web Services can be modeled with SOAPendpoints modeled as Actor addresses.
Objects with locks (
e.g.
as in Java and C#) can bemodeled as
serializers
(see below), provided thattheir implementations are such that messages cancontinually arrive.
Direct communication and asynchrony
Messages in the Actor model are decoupled from thesender and are delivered by the system on a best effortsbasis. This was a sharp break with previous approaches tomodels of concurrent computation in which messagesending is tightly coupled with the sender and sending amessage synchronously transfers it someplace
, e.g
., to a
buffer or to the “
ether
” or “
environment
” where it
temporarily resides. The lack of synchronicity caused agreat deal of misunderstanding at the time of thedevelopment of the Actor model and is still a controversialissue.Because message passing is taken as fundamental in theActor model, there cannot be any inherent overhead,
e.g.,
any requirement for buffers, channels,
etc
... Prior to theActor model, concurrency was defined in low levelmachine terms of threads, locks, channels, queues, cores,
etc
. It certainly is the case that implementations of theActor model typically make use of these hardwarecapabilities. However, there is no reason that the modelcould not be implemented directly in hardware withoutexposing any hardware threads, locks, queues, channels,tasks,
etc.
Also, there is no necessary relationship betweenthe number of Actors and the number threads, locks, tasks,queues,
etc.
that might be in use. Implementations of theActor model are free to make use of threads, locks, tasks,queues, global assignment, coherent memory, transactionalmemory, cores,
etc
. in any way that is compatible with thelaws for Actors.As opposed to the previous approach based on composingsequential processes, the Actor model was developed as aninherently concurrent model. In the Actor model sequential