Actor Oriented Programming, Fault Tolerance and OTP Dhananjay Nene #devcamp pune  April 9 th , 2011
What is the Actor Model ?
“ In computer science, the Actor model 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.” –  Wikipedia (Actor Model)
Erlang Process Model
In erlang parlance, each actor is a process
However thats not the same as an operating system process. A single OS process hosts many erlang processes. An erlang process is far lighter than even a thread.
Isolation : Processes are isolated. They do not share any memory between themselves. Garbage collection also works independently per processes
Since processes run concurrently, the inability to share memory between them reduces many of the difficulties associated with conventional multi threaded programming
Messages : Processes interact with each other by sending each other messages asynchronously
For asynchronous messaging to work each process has a mailbox of messages and it processes one message at a time from the mailbox
Introduction : Sleeping Barber Problem
OTP : Open Telecom Platform
OTP plays a somewhat similar role as JEE does for Java
OTP Design Patterns : Application
Server
Supervisor
State Machines
Event Handling
Philosophy : Let it crash
Let it crash actually encouraging higher availability initially seems like an oxymoron
But what it really emphasises is the ensured continued availability of the overall system rather than the robustness of every small piece that forms it.
So what features of erlang help fault tolerance?

Actors, Fault tolerance and OTP

  • 1.
    Actor Oriented Programming,Fault Tolerance and OTP Dhananjay Nene #devcamp pune April 9 th , 2011
  • 2.
    What is theActor Model ?
  • 3.
    “ In computerscience, the Actor model 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.” – Wikipedia (Actor Model)
  • 4.
  • 5.
    In erlang parlance,each actor is a process
  • 6.
    However thats notthe same as an operating system process. A single OS process hosts many erlang processes. An erlang process is far lighter than even a thread.
  • 7.
    Isolation : Processesare isolated. They do not share any memory between themselves. Garbage collection also works independently per processes
  • 8.
    Since processes runconcurrently, the inability to share memory between them reduces many of the difficulties associated with conventional multi threaded programming
  • 9.
    Messages : Processesinteract with each other by sending each other messages asynchronously
  • 10.
    For asynchronous messagingto work each process has a mailbox of messages and it processes one message at a time from the mailbox
  • 11.
  • 12.
    OTP : OpenTelecom Platform
  • 13.
    OTP plays asomewhat similar role as JEE does for Java
  • 14.
    OTP Design Patterns: Application
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
    Let it crashactually encouraging higher availability initially seems like an oxymoron
  • 21.
    But what itreally emphasises is the ensured continued availability of the overall system rather than the robustness of every small piece that forms it.
  • 22.
    So what featuresof erlang help fault tolerance?