Difference between revisions of "Actor Model"
From MohidWiki
Line 23: | Line 23: | ||
[[File:am.02.png|thumb|left|alt=Actor MW3 is the first actor to terminate its time-step.|(1) Actor MW3 is the first actor to terminate its time-step.]]Suppose Actor MW3 is the first actor to terminate its timestep. It sends messages to other actors with border conditions. MW3 has no messages in its mailbox so it is idle. Actor MW2 has a message in its mailbox but it can not process it yet so the message stays there. | [[File:am.02.png|thumb|left|alt=Actor MW3 is the first actor to terminate its time-step.|(1) Actor MW3 is the first actor to terminate its time-step.]]Suppose Actor MW3 is the first actor to terminate its timestep. It sends messages to other actors with border conditions. MW3 has no messages in its mailbox so it is idle. Actor MW2 has a message in its mailbox but it can not process it yet so the message stays there. | ||
− | MW3 will react when a message arrives to its mailbox. When it gathers enought information to strat a new time-step it will react triggering a new computation. | + | MW3 will react when a message arrives to its mailbox. When it gathers enought information to strat a new time-step it will react triggering a new computation. There is no central authority ordering it to stat, stay idle, etc. |
− | + | ||
+ | [[File:am.05.png|thumb|right|alt=(2) Comment.|Name.]] | ||
<p>[[File:am.03.png|thumb|left|alt=(3) Comment.|Name.]]All actors are computing a new timestep.</p> | <p>[[File:am.03.png|thumb|left|alt=(3) Comment.|Name.]]All actors are computing a new timestep.</p> | ||
<p>[[File:am.04.png|thumb|right|alt=(4) Comment.|Name.]]</p> | <p>[[File:am.04.png|thumb|right|alt=(4) Comment.|Name.]]</p> |
Revision as of 09:59, 23 January 2014
There are several resources in the Internet explaining the Actor Model and Reactive Programing. Some videos with interesting interviews:
- Hewitt, Meijer and Szyperski: The Actor Model (everything you wanted to know, but were afraid to ask)[1]; and
- Francesco Cesarini and Viktor Klang on the Reactive Manifesto[2].
To read on-line:
According to the Wikipedia[5] "the actor model in computer science is a mathematical model of concurrent computation that treats "actors" as the universal primitives of concurrent digital computation: in response to a message that it receives, an actor can make local decisions, create more actors, send more messages, and determine how to respond to the next message received" (changing state).
Actor Model in Mohikd
Suppose a domain is decomposed in 3 sub-domains according to the first image. Each sub-dmain is an actor that sends messages to other actors and reactes to messages it receives. Each model has a Main Loop that progresses in time-steps. Each model sends messages with information (for example border conditions) to actors that need it.
There is no need for a centralized controller, each actor has a state and reactes to the environment as a living organism. Inconsistencies or partial failures should be resolved in another layer, for instance with the help of supervisors (this is Erlang/OTP strategy).
MW3 will react when a message arrives to its mailbox. When it gathers enought information to strat a new time-step it will react triggering a new computation. There is no central authority ordering it to stat, stay idle, etc.