Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Life of an Erlang process

Life of an Erlang process

A high-level introduction to the Erlang programming language: among other topics, the talk covers Erlang processes, message passing, supervision trees, the let-it-crash approach and more.
We unfold the skeleton of an Erlang process, explaining how the functional model makes the implementation of Erlang processes straightforward. We reveal the recipe of the secret Erlang sauce which makes possible the creation of reliable, scalable systems which never go down.

Roberto Aloi

March 28, 2015
Tweet

More Decks by Roberto Aloi

Other Decks in Programming

Transcript

  1. Cheap to create Cheap to context switch OS processes out

    of discussion Use lightweight processes Built-in distribution to horizontally scale
  2. How are processes made? This is a little embarrassing, but…

    Ahem… I’m not sure I understand everything of it… I’ve heard rumours, still… Do you, do you mind if I ask you…
  3. Pid2 Pid1 Pid2 ! {self(), Msg} {Pid1, Msg} receive {From,

    start} -> … {From, stop} -> … end Send Receive
  4. start(Args) -> spawn(server, init, [Args]) init(Args) -> State = do_init(Args),

    loop(State). loop(State) ->
 receive
 {handle, Msg} -> 
 NewState = handle(Msg, State),
 loop(NewState);
 stop -> terminate(State)
 end. terminate(State) -> clean_up(State). Start Stop Initialize Terminate Loop
  5. erlang.org github.com/erlang/otp erlang-solutions.com www.learnyousomeerlang.org Erlang Programming Erlang and OTP in

    Action Official Home Page Sources Binary Packages, News, Events Best Online Tutorial Best book about basics Best book about OTP Where to Start