Difference between revisions of "Actor Model"
From MohidWiki
(→Relevance of the Actor Model) |
|||
Line 13: | Line 13: | ||
</ul> | </ul> | ||
− | == Relevance of the Actor Model == | + | The actor model makes it easier to reason about distributed programming. All MPI directives will be packed up in a set of well defined modules. Communication among actors takes place through clear and standard interfaces with well defined behaviors. This software architecture is proven to provide scalability, resilience and responsiveness. There is no central management and no points of synchronism so actors just react to events; this is a simpler way of reasoning about concurrency and parallelism. |
+ | |||
+ | According to Carl Hewitts' definition (Carl Hewitt; Peter Bishop; Richard Steiger (1973). A Universal Modular Actor Formalism for Artificial Intelligence. IJCAI) an actor is the fundamental unit of computation that embodies: | ||
+ | <ul> | ||
+ | <li>processing (the behavior, the executable code);</li> | ||
+ | <li>storage (its the state, the stuff on the heap, memory); and</li> | ||
+ | <li>communication.</li> | ||
+ | </ul> | ||
+ | |||
+ | When an actor recieves a message it reacts: | ||
+ | <ul> | ||
+ | <li>sending messages to actors it knows (finite number);</li> | ||
+ | <li>creating new actors (finite number); and</li> | ||
+ | <li>designating how it should handle the next message it receives (changing state).</li> | ||
+ | </ul> | ||
+ | |||
+ | == Relevance of the Actor Model for the Mohid system == | ||
The actor model makes it easier to reason about distributed programming. All MPI directives will be packed up in a set of well defined modules. Communication among actors takes place through clear and standard interfaces with well defined behaviors. This software architecture is proven to provide scalability, resilience and responsiveness. There is no central management and no points of synchronism so actors just react to events; this is a simpler way of reasoning about concurrency and parallelism. | The actor model makes it easier to reason about distributed programming. All MPI directives will be packed up in a set of well defined modules. Communication among actors takes place through clear and standard interfaces with well defined behaviors. This software architecture is proven to provide scalability, resilience and responsiveness. There is no central management and no points of synchronism so actors just react to events; this is a simpler way of reasoning about concurrency and parallelism. |
Revision as of 13:31, 24 January 2014
According to the Wikipedia[1] "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).
There are several resources in the Internet explaining the Actor Model and Reactive Programing. Some videos and interesting interviews:
- Hewitt, Meijer and Szyperski: The Actor Model (everything you wanted to know, but were afraid to ask)[2];
- Francesco Cesarini and Viktor Klang on the Reactive Manifesto[3]; and
- Up And Out Scaling Software With Akka - Jonas Bonér[4]
To read on-line:
The actor model makes it easier to reason about distributed programming. All MPI directives will be packed up in a set of well defined modules. Communication among actors takes place through clear and standard interfaces with well defined behaviors. This software architecture is proven to provide scalability, resilience and responsiveness. There is no central management and no points of synchronism so actors just react to events; this is a simpler way of reasoning about concurrency and parallelism.
According to Carl Hewitts' definition (Carl Hewitt; Peter Bishop; Richard Steiger (1973). A Universal Modular Actor Formalism for Artificial Intelligence. IJCAI) an actor is the fundamental unit of computation that embodies:
- processing (the behavior, the executable code);
- storage (its the state, the stuff on the heap, memory); and
- communication.
When an actor recieves a message it reacts:
- sending messages to actors it knows (finite number);
- creating new actors (finite number); and
- designating how it should handle the next message it receives (changing state).
Relevance of the Actor Model for the Mohid system
The actor model makes it easier to reason about distributed programming. All MPI directives will be packed up in a set of well defined modules. Communication among actors takes place through clear and standard interfaces with well defined behaviors. This software architecture is proven to provide scalability, resilience and responsiveness. There is no central management and no points of synchronism so actors just react to events; this is a simpler way of reasoning about concurrency and parallelism.
According to Carl Hewitts' definition (Carl Hewitt; Peter Bishop; Richard Steiger (1973). A Universal Modular Actor Formalism for Artificial Intelligence. IJCAI) an actor is the fundamental unit of computation that embodies:
- processing (the behavior, the executable code);
- storage (its the state, the stuff on the heap, memory); and
- communication.
When an actor recieves a message it reacts:
- sending messages to actors it knows (finite number);
- creating new actors (finite number); and
- designating how it should handle the next message it receives (changing state).
Actor Model in Mohid
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 reacts 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 reacts 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 enough information to strat a new time-step it will react triggering some computations. There is no central authority ordering it to start, stay idle, etc.
MW1 received a message form MW2 and will react accordingly.
MW1 sends a message to MW2 and both actors have enough information to proceed (reacting to messages).
Notes on the Actor Model
There are some remarks to be done:
- each message is sent only once;
- the sender does not verify if the message reaches its destination;
- the order of arrival is independent of the order of sending;
- there is no central point of control; and
- messages in mailbox are not processed in the order of arrival, there is a loop over the queue checking which messages the actor can react upon.