Erlang: distributed programming

Size: px
Start display at page:

Download "Erlang: distributed programming"

Transcription

1 Erlang: distributed May 11, / 21

2 Fault tolerance in Erlang links, exit signals, system process in Erlang OTP Open Telecom Platform 2 / 21

3 General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced 3 / 21

4 General idea General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced system process handles exit signals from linked processes traps exit messages { EXIT,Pid,Why} default: usual process dies if Why normal link connection between 2 processes symmetric, must be set explicitely exit signal sent to the set of linked processes when process dies { EXIT,B,Why} when process finishes { EXIT,B,normal} A 4 / 21

5 General idea General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced system process handles exit signals from linked processes traps exit messages { EXIT,Pid,Why} default: usual process dies if Why normal link connection between 2 processes symmetric, must be set explicitely exit signal sent to the set of linked processes when process dies { EXIT,B,Why} when process finishes { EXIT,B,normal} A B 4 / 21

6 General idea General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced system process handles exit signals from linked processes traps exit messages { EXIT,Pid,Why} default: usual process dies if Why normal link connection between 2 processes symmetric, must be set explicitely exit signal sent to the set of linked processes when process dies { EXIT,B,Why} when process finishes { EXIT,B,normal} A B 4 / 21

7 General idea General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced system process handles exit signals from linked processes traps exit messages { EXIT,Pid,Why} default: usual process dies if Why normal link connection between 2 processes symmetric, must be set explicitely exit signal sent to the set of linked processes when process dies { EXIT,B,Why} when process finishes { EXIT,B,normal} A { EXIT,B,Why} B 4 / 21

8 Links General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced link defines error propagation path between 2 processes if one dies then another gets exit signal links are established with link(b) or spawn_link(fun) 5 / 21

9 Exit signals General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced exit signal generated when process dies or finishes { EXIT,Pid,Why} Why=normal if a process just finishes (i.e. recursion ends) Why=<exception desc> if there was a problem exit(why) may be called to stop itself sent to all linked processes faking death: exit(pid2, Why) sends { EXIT,Pid,Why} to process Pid2 continues exection 6 / 21

10 System processes General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced usual process dies if receives exit signal from any linked process where Why normal system process set with process_flag(trap_exit,true) traps exit signals from linked processes messages { EXIT,Pid,Why} are added to its mailbox exit signals with Why=kill are not caught at all! process is killed, even system process { EXIT,Pid,killed} broadcasted to all linked processes (notice that kill is propagated as killed) 7 / 21

11 General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced on_exit(pid, Fun) -> spawn(fun() -> process_flag(trap_exit, true), link(pid), receive { EXIT,Pid,Why} -> Fun(Why) end end). 8 / 21

12 General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced F = fun() -> receive X -> list_to_atom(x) end end. Pid = spawn(f). on_exit(pid, fun(why) -> io:format("~p died with ~p~n",[pid,why]) end). create a process that transforms lists to atoms add error handler with on_exit Now sending Pid! hello. results in <0.61.0> died with:{badarg,[{ 9 / 21

13 Summary of exit signals trap_exit Exit signal Action true kill Die: broadcast the exit signal killed to the link set true X Add { EXIT,Pid,X} to the mailbox false normal Continue: Do nothing, signal vanishes false kill Die: broadcast the exit signal killed to the link set false X Die: broadcast the exit signal X to the link set 10 / 21

14 Idioms for trapping exits General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced 1. Don t care about new process Pid=spawn(fun() ->... end) 2. Want to die if new process dies Pid=spawn_link(fun() ->... end) 3. Want to handle errors if new process dies... process_flag(trap_exit, true), Pid=spawn_link(fun() ->... end), loop(...). loop(state) -> receive { EXIT, SomePid, Reason} -> %% do something with the error loop(state1)... end. 11 / 21

15 Advanced General idea Links Exit signals System processes Summary of exit signals Idioms for trapping exits Advanced one fails everyone up to system process dies P1 P2 P3 P4 one fails supervisor process restarts one or all Sup P1 P2 P3 12 / 21

16 Create servers Distribution primitives 13 / 21

17 Create servers Distribution primitives 1. Erlang spawn process on any Erlang node Erlang VM instance message passing and error handling works without changes run any module function on any node unsafe: should be used in trusted environments, e.g. dedicated LAN 2. Socket based distribution handle and abstract TCP socket communication lib_chan module in examples safe: use in untrusted environments, e.g. internet 14 / 21

18 Create servers Create servers Distribution primitives $ erl -sname <name[@server]> short name, usable only on the same host $ erl -name <name[@fqdn]> server name, DNS must be accessible, at least /etc/hosts olegus@hebe:~$ erl -name myerlangnode Erlang R15B (erts-5.9) [source] [64-bit] [smp: Eshell V5.9 (abort with ^G) (myerlangnode@hebe.domenis.ut.ee)1> different machines must have the same cookie ~/.erlang.cookie -setcookie parameter 15 / 21

19 Distribution primitives Create servers Distribution primitives built in rpc module rpc:call(node,mod,function,args) -> Result {badrpc,reason} built in global module extended spawn functions, etc spawn(node,fun) -> Pid spawn(node,mod,func,arglist) -> Pid spawn_link(node,fun) -> Pid spawn_link(node,mod,func,arglist) -> Pid disconnect_node(node) -> bool() ignored node() -> Node node(arg) -> Node nodes() -> [Node] Pid! Msg {RegName,Node}! Msg 16 / 21

20 Create servers Distribution primitives Run 2 servers with names me and you erl -sname me@localhost erl -sname you@localhost Test with (run from you ) (you@localhost)8> rpc:call(me@localhost, io, format, ["hello~n"]). hello (you@localhost)9> rpc:call(me@localhost, erlang, node, []). me@localhost test remote spawn / 21

21 Create servers Distribution primitives Write and compile dist.erl -module(dist). -export([start/0]). loop() -> receive X -> io:format("~p: Im running on ~p~n", [X,node()]) end, loop(). test it 13> RP = spawn(me@localhost, fun dist:loop/0). 14> RP! "Hi". "Hi": Im running on me@localhost 18 / 21

22 Description 19 / 21

23 Description provides process restart strategies, event and error logging, etc. declare gen_server module behaviour (checks for undefined functions during compilation) -module(myserver). -behaviour(gen_server). specify 6 callbacks init(startargs) -> {ok, InitState}. handle_call(msg,from,state) -> {reply, ok, State} handle_cast(msg,state) -> {noreply, State}. handle_info(info,state) -> {noreply, State}. terminate(reason, State) -> ok. code_change(oldv, State, Extra) -> {ok, State}. start server with gen_server:start_link(name, CallBackMod, StartArgs, Opts) 20 / 21

24 Description Description handle_call is a state transform function that is called for each incoming message (synchronous) handle_cast is the same but does not return value (asynchronous) handle_info is for spontaneous messages, e.g. exit signals from linked processes terminate is executed when agent stops code_change is code hot swapping 21 / 21

An Introduction to Erlang

An Introduction to Erlang An Introduction to Erlang Part 2 - Concurrency Richard Carlsson Processes P1 fib(0) -> 1; fib(1) -> 1; fib(n) when N > 0 -> fib(n-1) + fib(n-2). Whenever an Erlang program is running, the code is executed

More information

Erlang: An Overview. Part 2 Concurrency and Distribution. Thanks to Richard Carlsson for most of the slides in this part

Erlang: An Overview. Part 2 Concurrency and Distribution. Thanks to Richard Carlsson for most of the slides in this part Erlang: An Overview Part 2 Concurrency and Distribution Thanks to Richard Carlsson for most of the slides in this part Processes P1 fib(0) -> 1; fib(1) -> 1; fib(n) when N > 0 -> fib(n-1) + fib(n-2). Whenever

More information

Erlang 101. Google Doc

Erlang 101. Google Doc Erlang 101 Google Doc Erlang? with buzzwords Erlang is a functional concurrency-oriented language with extremely low-weight userspace "processes", share-nothing messagepassing semantics, built-in distribution,

More information

Robust Erlang (PFP Lecture 11) John Hughes

Robust Erlang (PFP Lecture 11) John Hughes Robust Erlang (PFP Lecture 11) John Hughes Genesis of Erlang Problem: telephony systems in the late 1980s Digital More and more complex Highly concurrent Hard to get right Approach: a group at Ericsson

More information

Erlang. Functional Concurrent Distributed Soft real-time OTP (fault-tolerance, hot code update ) Open. Check the source code of generic behaviours

Erlang. Functional Concurrent Distributed Soft real-time OTP (fault-tolerance, hot code update ) Open. Check the source code of generic behaviours Lecture 9 Erlang Erlang Functional Concurrent Distributed Soft real-time OTP (fault-tolerance, hot code update ) Open Check the source code of generic behaviours 2 Functional Haskell call-by-need (lazy)

More information

Erlang. Functional Concurrent Distributed Soft real-time OTP (fault-tolerance, hot code update ) Open. Check the source code of generic behaviours

Erlang. Functional Concurrent Distributed Soft real-time OTP (fault-tolerance, hot code update ) Open. Check the source code of generic behaviours Lecture 10 Erlang Erlang Functional Concurrent Distributed Soft real-time OTP (fault-tolerance, hot code update ) Open Check the source code of generic behaviours 2 Functional Haskell call-by-need (lazy)

More information

An Introduction to Erlang

An Introduction to Erlang Erlang Solutions Ltd An Introduction to Erlang From behind the trenches GOTO Copenhagen May 13 th, 2011 Francesco Cesarini Founder, Technical Director @FrancescoC francesco@erlang-solutions.com So Here

More information

Introduction to Erlang. Franck Petit / Sebastien Tixeuil

Introduction to Erlang. Franck Petit / Sebastien Tixeuil Introduction to Erlang Franck Petit / Sebastien Tixeuil Firstname.Lastname@lip6.fr Hello World % starts a comment. ends a declaration Every function must be in a module one module per source file source

More information

Erlang. Joe Armstrong

Erlang. Joe Armstrong Erlang Joe Armstrong Though OOP came from many motivations, two were central. The large scale one was to find a better module scheme for complex systems involving hiding of details, and the small scale

More information

FRANCESCO CESARINI. presents ERLANG/OTP. Francesco Cesarini Erlang

FRANCESCO CESARINI. presents ERLANG/OTP. Francesco Cesarini Erlang FRANCESCO CESARINI presents Francesco Cesarini Erlang Solutions ERLANG/OTP @FrancescoC francesco@erlang-solutions.com www.erlang-solutions.com WHAT IS SCALABILITY? WHAT IS (MASSIVE) CONCURRENCY? WHAT

More information

Erlang functional programming in a concurrent world

Erlang functional programming in a concurrent world KTH ROYAL INSTITUTE OF TECHNOLOGY Erlang functional programming in a concurrent world Johan Montelius and Vladimir Vlassov Erlang Concurrent Oriented Programming processes have state communicate using

More information

Erlang functional programming in a concurrent world Johan Montelius and Vladimir Vlassov

Erlang functional programming in a concurrent world Johan Montelius and Vladimir Vlassov KTH ROYAL INSTITUTE OF TECHNOLOGY Erlang functional programming in a concurrent world Johan Montelius and Vladimir Vlassov Erlang Concurrent Oriented Programming processes have state communicate using

More information

An Introduction to Erlang

An Introduction to Erlang Erlang Solutions Ltd An Introduction to Erlang From behind the trenches GOTO Amsterdam Amsterdam, May 25 th 2012 Francesco Cesarini Founder, Technical Director @FrancescoC francesco@erlang-solutions.com

More information

Starting the System & Basic Erlang Exercises

Starting the System & Basic Erlang Exercises Starting the System & Basic Erlang Exercises These exercises will help you get accustomed with the Erlang development and run time environments. Once you have set up the Erlang mode for emacs, you will

More information

concurrent programming XXL

concurrent programming XXL concurrent programming XXL Industrial Use of Erlang Introduction Karol Ostrovský (karol.ostrovsky@gmail.com) Motivation Machine Ericsson Blade System 3 sub-racks 14 blades 2 routers 12 compute nodes 6

More information

An Introduction to Erlang

An Introduction to Erlang Erlang Solutions Ltd An Introduction to Erlang From behind the trenches Erlang Factory Lite Zurich, April 23 rd 2012 Francesco Cesarini Founder, Technical Director @FrancescoC francesco@erlang-solutions.com

More information

Experiments in OTP-Compliant Dataflow Programming

Experiments in OTP-Compliant Dataflow Programming Experiments in OTP-Compliant Dataflow Programming Introducing Erlang Services Platform (Erlang/SP) San Francisco Erlang Factory, March 21, 2013 Jay Nelson Twitter: @duomark Email: Jay@duomark.com Manycore

More information

Message-passing concurrency in Erlang

Message-passing concurrency in Erlang Message-passing concurrency in Erlang Lecture 8 of TDA383/DIT390 (Concurrent Programming) Carlo A. Furia Chalmers University of Technology University of Gothenburg SP3 2016/2017 Today s menu Actors and

More information

Lecture 5: Erlang 1/31/12

Lecture 5: Erlang 1/31/12 Principles of Concurrency and Parallelism Lecture 5: Erlang 1/31/12 Example Suppose we have N threads (or processes, tasks) that form a ring Each thread communicates with its neighbor forwarding a message

More information

DISTRIBUTED SYSTEMS [COMP9243] Lecture 1.5: Erlang INTRODUCTION TO ERLANG BASICS: SEQUENTIAL PROGRAMMING 2. Slide 1

DISTRIBUTED SYSTEMS [COMP9243] Lecture 1.5: Erlang INTRODUCTION TO ERLANG BASICS: SEQUENTIAL PROGRAMMING 2. Slide 1 DISTRIBUTED SYSTEMS [COMP9243] THE ERLANG ENVIRONMENT Slide 1 Lecture 1.5: Erlang ➀ Introduction ➁ Basics: Sequential programming ➂ Concurrent programming Slide 3 unix% erl 1> 1 + 2. 3 2> c(demo). {ok,demo}

More information

Reminder from last time

Reminder from last time Concurrent systems Lecture 5: Concurrency without shared data, composite operations and transactions, and serialisability DrRobert N. M. Watson 1 Reminder from last time Liveness properties Deadlock (requirements;

More information

The Actor Model, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014

The Actor Model, Part Two. CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014 The Actor Model, Part Two CSCI 5828: Foundations of Software Engineering Lecture 18 10/23/2014 1 Goals Cover the material presented in Chapter 5, of our concurrency textbook In particular, the material

More information

Erlang. An introduction. Paolo Baldan Linguaggi e Modelli per il Global Computing AA 2016/2017

Erlang. An introduction. Paolo Baldan Linguaggi e Modelli per il Global Computing AA 2016/2017 Erlang An introduction Paolo Baldan Linguaggi e Modelli per il Global Computing AA 2016/2017 Erlang, in a slogan Declarative (functional) language for concurrent and distributed systems Erlang = Functions

More information

S AMPLE CHAPTER. Erlang AND OTP IN ACTION. Martin Logan Eric Merritt Richard Carlsson FOREWORD BY ULF WIGER MANNING

S AMPLE CHAPTER. Erlang AND OTP IN ACTION. Martin Logan Eric Merritt Richard Carlsson FOREWORD BY ULF WIGER MANNING S AMPLE CHAPTER Erlang AND OTP IN ACTION Martin Logan Eric Merritt Richard Carlsson FOREWORD BY ULF WIGER MANNING Erlang and OTP in Action by Martin Logan Eric Merritt Richard Carlsson Chapter 3 Copyright

More information

Macros, and protocols, and metaprogramming - Oh My!

Macros, and protocols, and metaprogramming - Oh My! Macros, and protocols, and metaprogramming - Oh My! (aka "What is Elixir and why should you care?") jim mccoy, Facebook Infosec Tools mccoy@fb.com (jim.mccoy@gmail.com) Who? Currently build and maintain

More information

Maturing, I'll try to provide backwards compatibility for 2 freeswitch releases if I have to make an API change.

Maturing, I'll try to provide backwards compatibility for 2 freeswitch releases if I have to make an API change. mod_erlang_event About mod_erlang_event is a derivative of mod_event_socket that sends events and receives commands in erlang's binary term format. This allows FreeSWITCH to behave like just another erlang

More information

Erlang - functional programming in a concurrent world. Johan Montelius KTH

Erlang - functional programming in a concurrent world. Johan Montelius KTH Erlang - functional programming in a concurrent world Johan Montelius KTH 1 Erlang Concurrent Oriented Programming processes have state communicate using message passing access and location transparent

More information

Distributed Erlang and Map-Reduce

Distributed Erlang and Map-Reduce Distributed Erlang and Map-Reduce The goal of this lab is to make the naïve map-reduce implementation presented in the lecture, a little less naïve. Specifically, we will make it run on multiple Erlang

More information

Beautiful Concurrency with Erlang

Beautiful Concurrency with Erlang Beautiful Concurrency with Erlang Kevin Scaldeferri OSCON 23 July 2008 6 years at Yahoo, building large high-concurrency distributed systems Not an expert, don t use it professionally Dabbled, liked it,

More information

Cliff Moon. Bottleneck Whack-A-Mole. Thursday, March 21, 13

Cliff Moon. Bottleneck Whack-A-Mole. Thursday, March 21, 13 Cliff Moon Bottleneck Whack-A-Mole Whack-A-Mole Production Experience Your Mileage May Vary. This is all folklore. Unless otherwise specified - R14B04. Down in the weeds. Collectors Terminates SSL and

More information

Rudy: a small web server. Johan Montelius. October 2, 2016

Rudy: a small web server. Johan Montelius. October 2, 2016 Rudy: a small web server Johan Montelius October 2, 2016 Introduction Your task is to implement a small web server in Erlang. The aim of this exercise is that you should be able to: describe the procedures

More information

Processes. Johan Montelius KTH

Processes. Johan Montelius KTH Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other

More information

A process. the stack

A process. the stack A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes

More information

Scenes From the Language Struggle in Toronto, Ontario. Mike Nolta

Scenes From the Language Struggle in Toronto, Ontario. Mike Nolta Scenes From the Language Struggle in Toronto, Ontario Mike Nolta Ch-Ch-Changes OpenMP & MPI are fine for now, but we need language support for parallelism. Corbato s Law: The number of lines of code a

More information

The Little Elixir & OTP Guidebook by Tan Wei Hao

The Little Elixir & OTP Guidebook by Tan Wei Hao SAMPLE CHAPTER The Little Elixir & OTP Guidebook by Tan Wei Hao Chapter 9 Copyright 2016 Manning Publications brief contents PART 1 GETTING STARTED WITH ELIXIR AND OTP...1 1 Introduction 3 2 A whirlwind

More information

VALEO: programs robustifier

VALEO: programs robustifier VALEO: programs robustifier by Younès HAFRI younes.hafri@aleph-archives.com talk to the outside? 3 Who Am I? Aleph Archives' CTO & Founder love coding hate complexity love un-optimizing programs hate cooking

More information

Erlang. Joe Armstrong.

Erlang. Joe Armstrong. Erlang Joe Armstrong joe.armstrong@ericsson.com 1 Who is Joe? Inventor of Erlang, UBF, Open Floppy Grid Chief designer of OTP Founder of the company Bluetail Currently Software Architect Ericsson Current

More information

Kent Academic Repository

Kent Academic Repository Kent Academic Repository Full text document (pdf) Citation for published version Cesarini, Francesco and Thompson, Simon (2010) Erlang Behaviours: Programming With Process Design Patterns. In: Central

More information

The Actor Model applied to the Raspberry Pi and the Embedded Domain. The Erlang Embedded Project. Omer

The Actor Model applied to the Raspberry Pi and the Embedded Domain. The Erlang Embedded Project. Omer The Actor Model applied to the Raspberry Pi and the Embedded Domain. The Erlang Embedded Project Omer Kilic @OmerK omer@erlang-solutions.com Outline Current state of Embedded Systems Overview of Erlang

More information

OTP Design Principles. version 5.6

OTP Design Principles. version 5.6 version 5.6 Typeset in L A TEX from SGML source using the DocBuilder-0.9.7 Document System. Contents 1 1 1.1 Overview........................................... 1 1.1.1 Supervision Trees...................................

More information

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016

Distributed Systems Exam 1 Review. Paul Krzyzanowski. Rutgers University. Fall 2016 Distributed Systems 2016 Exam 1 Review Paul Krzyzanowski Rutgers University Fall 2016 Question 1 Why does it not make sense to use TCP (Transmission Control Protocol) for the Network Time Protocol (NTP)?

More information

Principles of Programming Languages (E)

Principles of Programming Languages (E) Principles of Programming Languages (E) Matteo Pradella December 1, 2017 Matteo Pradella Principles of Programming Languages (E) December 1, 2017 1 / 49 Erlang: Overview 1 Sequential programming 2 Concurrent

More information

Namy: a distributed name server. Johan Montelius. October 2, 2016

Namy: a distributed name server. Johan Montelius. October 2, 2016 Introduction Namy: a distributed name server Johan Montelius October 2, 2016 Your task will be to implement a distributed name server similar to DNS. Instead of addresses we will store process identifiers

More information

Parallel Programming in Erlang (PFP Lecture 10) John Hughes

Parallel Programming in Erlang (PFP Lecture 10) John Hughes Parallel Programming in Erlang (PFP Lecture 10) John Hughes What is Erlang? Haskell Erlang - Types - Lazyness - Purity + Concurrency + Syntax If you know Haskell, Erlang is easy to learn! QuickSort again

More information

The Actor Model applied to the Raspberry Pi and the Embedded Domain. Omer

The Actor Model applied to the Raspberry Pi and the Embedded Domain. Omer The Actor Model applied to the Raspberry Pi and the Embedded Domain Omer Kilic @OmerK omer@erlang-solutions.com Agenda Current state of Embedded Systems Overview of the Actor Model Erlang Embedded Project

More information

Producer Consumer in Ada

Producer Consumer in Ada Concurrent Systems 8L for Part IB Handout 3 Dr. Steven Hand Example: Active Objects A monitor with an associated server thread Exports an entry for each operation it provides Other (client) threads call

More information

Erlectricity. Tom Preston-Werner. github.com/mojombo/erlectricity

Erlectricity. Tom Preston-Werner. github.com/mojombo/erlectricity Erlectricity Tom Preston-Werner github.com/mojombo/erlectricity 1 github 2 3 4 5 6 7 8 Like an Erlang Process that runs Ruby Erlang VM 9 Like an Erlang Process that runs Ruby Erlang VM 9 Like an Erlang

More information

Programming Paradigms

Programming Paradigms PP 2017/18 Unit 15 Concurrent Programming with Erlang 1/32 Programming Paradigms Unit 15 Concurrent Programming with Erlang J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE PP

More information

MODELS OF DISTRIBUTED SYSTEMS

MODELS OF DISTRIBUTED SYSTEMS Distributed Systems Fö 2/3-1 Distributed Systems Fö 2/3-2 MODELS OF DISTRIBUTED SYSTEMS Basic Elements 1. Architectural Models 2. Interaction Models Resources in a distributed system are shared between

More information

The Actor Model. CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016

The Actor Model. CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016 The Actor Model CSCI 5828: Foundations of Software Engineering Lecture 13 10/04/2016 1 Goals Introduce the Actor Model of Concurrency isolation, message passing, message patterns Present examples from

More information

Introduction to Erlang. Franck Petit / Sebastien Tixeuil

Introduction to Erlang. Franck Petit / Sebastien Tixeuil Introduction to Erlang Franck Petit / Sebastien Tixeuil Firstname.Lastname@lip6.fr Erlang History Erlang: Ericsson Language Designed to implement large-scale realtime telecommunication switching systems

More information

An Erlang primer. Johan Montelius

An Erlang primer. Johan Montelius An Erlang primer Johan Montelius Introduction This is not a crash course in Erlang since there are plenty of tutorials available on the web. I will however describe the tools that you need so that you

More information

Chordy: a distributed hash table. Johan Montelius and Vladimir Vlassov. August 29, 2016

Chordy: a distributed hash table. Johan Montelius and Vladimir Vlassov. August 29, 2016 Introduction Chordy a distributed hash table Johan Montelius and Vladimir Vlassov August 29, 2016 In this assignment you will implement a distributed hash table following the Chord scheme. In order to

More information

Erlang Concepts. Programming for Beginners, Summer 2011

Erlang Concepts. Programming for Beginners, Summer 2011 Programming for Beginners, Summer 2011 Erlang Concepts Erlang is a functional programming language that supports concurrent programming. Computations in Erlang can proceed in parallel on a network of computers,

More information

Erlang and Concurrency. André Pang Rising Sun Research

Erlang and Concurrency. André Pang Rising Sun Research Erlang and Concurrency André Pang Rising Sun Research Games. Unreal 3 engine. Amazing graphics. (Unreal 3 video demo.) 2004/2005? Still state-of-the-art. What does that game have to do with this talk?

More information

MapReduce in Erlang. Tom Van Cutsem

MapReduce in Erlang. Tom Van Cutsem MapReduce in Erlang Tom Van Cutsem 1 Context Masters course on Multicore Programming Focus on concurrent, parallel and... functional programming Didactic implementation of Google s MapReduce algorithm

More information

CS390 Principles of Concurrency and Parallelism. Lecture Notes for Lecture #5 2/2/2012. Author: Jared Hall

CS390 Principles of Concurrency and Parallelism. Lecture Notes for Lecture #5 2/2/2012. Author: Jared Hall CS390 Principles of Concurrency and Parallelism Lecture Notes for Lecture #5 2/2/2012 Author: Jared Hall This lecture was the introduction the the programming language: Erlang. It is important to understand

More information

Scaling Up from 1000 to 10 Nodes

Scaling Up from 1000 to 10 Nodes Scaling Up from 1000 to 10 Nodes Anton Lavrik Alert Logic, Inc. 1 Alert Logic vs Twitter: daily numbers (2012) Alert Logic Twitter Events received 11.5B 0.5B Volume received 5TB 70GB Logs produced? 100TB

More information

Typeset in L A TEX from SGML source using the DOCBUILDER 3.0 Document System.

Typeset in L A TEX from SGML source using the DOCBUILDER 3.0 Document System. version 1.1 Typeset in L A TEX from SGML source using the DOCBUILDER 3.0 Document System. Contents 1 User s Guide 1 1.1 Introduction......................................... 2 Architecture..........................................

More information

re-exam Concurrent Programming tda383/dit390 Date: Time: 14:00 18:00 Place: Maskinhuset (M)

re-exam Concurrent Programming tda383/dit390 Date: Time: 14:00 18:00 Place: Maskinhuset (M) re-exam Concurrent Programming tda383/dit390 Date: 2016-08-22 Time: 14:00 18:00 Place: Maskinhuset (M) Responsible Michał Pałka 031 772 10 79 Result Available no later than 2016-09-12 Aids Max 2 books

More information

<Urban.Boquist. com> Rev PA

<Urban.Boquist. com> Rev PA FP in industry - Erlang Urban Boquist Ericsson AB com> 1 Outline Who Am I Mobile Telecommunications Networks Packet Core Network GPRS & SGSN Use of Erlang in SGSN SGSN Design

More information

costransactions Copyright Ericsson AB. All Rights Reserved. costransactions April

costransactions Copyright Ericsson AB. All Rights Reserved. costransactions April costransactions Copyright 1999-2012 Ericsson AB. All Rights Reserved. costransactions 1.2.12 April 1 2012 Copyright 1999-2012 Ericsson AB. All Rights Reserved. The contents of this file are subject to

More information

An Introduction to Erlang. Richard Carlsson

An Introduction to Erlang. Richard Carlsson An Introduction to Erlang Richard Carlsson Erlang Buzzwords Functional (strict) Single-assignment Dynamically typed Concurrent Distributed Message passing Soft real-time Fault tolerant No sharing Automatic

More information

OSE Copyright Ericsson AB. All Rights Reserved. OSE 1.0 June 23, 2014

OSE Copyright Ericsson AB. All Rights Reserved. OSE 1.0 June 23, 2014 OSE Copyright 2014-2014 Ericsson AB. All Rights Reserved. OSE 1.0 June 23, 2014 Copyright 2014-2014 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public License,

More information

Reminder from last ;me

Reminder from last ;me Concurrent systems Lecture 5: Concurrency without shared data; transac;ons Dr Robert N. M. Watson 1 Reminder from last ;me Liveness proper;es Deadlock (requirements; resource alloca;on graphs; detec;on;

More information

Goldy: a distributed game. Johan Montelius. October 2, 2016

Goldy: a distributed game. Johan Montelius. October 2, 2016 Goldy a distributed game Johan Montelius October 2, 2016 Introduction This seminar will serve two purpose; learning how to program a distributed application in Erlang and understanding why distributed

More information

CHAPTER 4: INTERPROCESS COMMUNICATION AND COORDINATION

CHAPTER 4: INTERPROCESS COMMUNICATION AND COORDINATION CHAPTER 4: INTERPROCESS COMMUNICATION AND COORDINATION Chapter outline Discuss three levels of communication: basic message passing, request/reply and transaction communication based on message passing

More information

MODELS OF DISTRIBUTED SYSTEMS

MODELS OF DISTRIBUTED SYSTEMS Distributed Systems Fö 2/3-1 Distributed Systems Fö 2/3-2 MODELS OF DISTRIBUTED SYSTEMS Basic Elements 1. Architectural Models 2. Interaction Models Resources in a distributed system are shared between

More information

WE ARE ALL BLESSED. Bruce Tate

WE ARE ALL BLESSED. Bruce Tate WE ARE ALL BLESSED Bruce Tate Dave Thomas @redrapids @pragdave 1 DAVE'S STORY 2 3 4 https://upload.wikimedia.org/wikipedia/commons/0/0b/hand-operated_card_punch-2.jpg 5 https://upload.wikimedia.org/wikipedia/commons/e/e8/ibm_card_punch_029.jpg

More information

Lecture 9. Part I. Overview of Message Passing. Communication Coupling. Decoupling Blackboard. Decoupling Broadcast. Linda and Erlang.

Lecture 9. Part I. Overview of Message Passing. Communication Coupling. Decoupling Blackboard. Decoupling Broadcast. Linda and Erlang. Lecture 9 Part I Linda and Erlang Linda Overview of Message Passing Communication Coupling One process sends a message Another process awaits for a message We will consider two dimensions of this approach:

More information

Today: Fault Tolerance. Reliable One-One Communication

Today: Fault Tolerance. Reliable One-One Communication Today: Fault Tolerance Reliable communication Distributed commit Two phase commit Three phase commit Failure recovery Checkpointing Message logging Lecture 17, page 1 Reliable One-One Communication Issues

More information

All you need is fun. Cons T Åhs Keeper of The Code

All you need is fun. Cons T Åhs Keeper of The Code All you need is fun Cons T Åhs Keeper of The Code cons@klarna.com Cons T Åhs Keeper of The Code at klarna Architecture - The Big Picture Development - getting ideas to work Code Quality - care about the

More information

Concurre Concurr nt n Systems 8L for Part IB Handout 3 Dr. Steven Hand 1

Concurre Concurr nt n Systems 8L for Part IB Handout 3 Dr. Steven Hand 1 Concurrent Systems 8L for Part IB Handout 3 Dr. Steven Hand 1 Concurrency without shared data The examples so far have involved threads which h can arbitrarily read & write shared data A key need for mutual

More information

A Small Web Server. Programming II - Elixir Version. Johan Montelius. Spring Term 2018

A Small Web Server. Programming II - Elixir Version. Johan Montelius. Spring Term 2018 A Small Web Server Programming II - Elixir Version Johan Montelius Spring Term 2018 Introduction Your task is to implement a small web server in Elixir. exercise is that you should be able to: The aim

More information

Lecture 8. Linda and Erlang

Lecture 8. Linda and Erlang Lecture 8 Linda and Erlang Part I Linda 2 Overview of Message Passing One process sends a message Another process awaits for a message We will consider two dimensions of this approach: What form of synchronisation

More information

DISTRIBUTED COMPUTER SYSTEMS

DISTRIBUTED COMPUTER SYSTEMS DISTRIBUTED COMPUTER SYSTEMS Communication Fundamental REMOTE PROCEDURE CALL Dr. Jack Lange Computer Science Department University of Pittsburgh Fall 2015 Outline Communication Architecture Fundamentals

More information

Test-Driven Development of Concurrent Programs using Concuerror

Test-Driven Development of Concurrent Programs using Concuerror Test-Driven Development of Concurrent Programs using Concuerror Alkis Gotovos 1 Maria Christakis 1 Konstantinos Sagonas 1,2 1 School of Electrical and Computer Engineering, National Technical University

More information

erlang module Erlang Programming - Lecture 8

erlang module Erlang Programming - Lecture 8 erlang module Erlang Programming - Lecture 8 Saurabh Barjatiya Rekall Software Pvt. Ltd. 29 June, 2014 Contents erlang module Auto-imported Built-In Functions (BIFs) BIFs allowed in guard test 1 erlang

More information

EEC-682/782 Computer Networks I

EEC-682/782 Computer Networks I EEC-682/782 Computer Networks I Lecture 15 Wenbing Zhao w.zhao1@csuohio.edu http://academic.csuohio.edu/zhao_w/teaching/eec682.htm (Lecture nodes are based on materials supplied by Dr. Louise Moser at

More information

Interprocess Communication

Interprocess Communication Interprocess Communication Reading: Silberschatz chapter 4 Additional Reading: Stallings chapter 6 EEL 358 1 Outline Introduction Shared memory systems POSIX shared memory Message passing systems Direct

More information

Analysing and visualising callback modules of Erlang generic server behaviours

Analysing and visualising callback modules of Erlang generic server behaviours Analysing and visualising callback modules of Erlang generic server behaviours István Bozó bozoistvan@caesar.elte.hu Melinda Tóth tothmelinda@caesar.elte.hu Mátyás Béla Kuti matyas.kuti@gmail.com ELTE

More information

Erlang: concurrent programming. Johan Montelius. October 2, 2016

Erlang: concurrent programming. Johan Montelius. October 2, 2016 Introduction Erlang: concurrent programming Johan Montelius October 2, 2016 In this assignment you should implement the game of life, a very simple simulation with surprising results. You will implement

More information

Distributed Places. Version 6.3. Kevin Tew. November 20, (require racket/place/distributed)

Distributed Places. Version 6.3. Kevin Tew. November 20, (require racket/place/distributed) Distributed Places Version 6.3 Kevin Tew November 20, 2015 (require racket/place/distributed) package: distributed-places-lib See also 20.3 Distributed Places in The Racket Guide. Distributed places support

More information

Actors and Channels in Core λ-calculi. Simon Fowler Joint work with Sam Lindley and Philip Wadler

Actors and Channels in Core λ-calculi. Simon Fowler Joint work with Sam Lindley and Philip Wadler Actors and Channels in Core λ-calculi Simon Fowler Joint work with Sam Lindley and Philip Wadler ABCD Meeting, January 2016 Actors and Channels Hopac Actors and Channels Process Actor Process Process Hopac

More information

The do s and don ts of error handling. Joe Armstrong

The do s and don ts of error handling. Joe Armstrong The do s and don ts of error handling Joe Armstrong A system is fault tolerant if it continues working even if something is wrong Work like this is never finished it s always in-progress Hardware can fail

More information

CS 347: Distributed Databases and Transaction Processing Notes07: Reliable Distributed Database Management

CS 347: Distributed Databases and Transaction Processing Notes07: Reliable Distributed Database Management CS 347: Distributed Databases and Transaction Processing Notes07: Reliable Distributed Database Management Hector Garcia-Molina CS 347 Notes07 1 Reliable distributed database management Reliability Failure

More information

Process Control. Philipp Koehn. 23 April 2018

Process Control. Philipp Koehn. 23 April 2018 Process Control Philipp Koehn 23 April 2018 Control Flow 1 The CPU executes one instruction after another Typically, they are next to each other in memory (unless jumps, branches, and returns from subroutine)

More information

Two Phase Commit Protocol. Distributed Systems. Remote Procedure Calls (RPC) Network & Distributed Operating Systems. Network OS.

Two Phase Commit Protocol. Distributed Systems. Remote Procedure Calls (RPC) Network & Distributed Operating Systems. Network OS. A distributed system is... Distributed Systems "one on which I cannot get any work done because some machine I have never heard of has crashed". Loosely-coupled network connection could be different OSs,

More information

ERLANG BITS AND PIECES

ERLANG BITS AND PIECES ERLANG BITS AND PIECES Curt Clifton Rose-Hulman Institute of Technology Update ErlangInClass, open bap.erl GUARDS Guards are boolean-valued Erlang expressions, used in Function definitions: max(x,y) when

More information

Introduction. version 5.0

Introduction. version 5.0 Introduction version 5.0 Typeset in L A TEX from SGML source using the DOCBUILDER 3.0 Document System. Contents 1 Introduction 1 1.1 Introduction.......................................... 2 Erlang and

More information

Kernel Copyright Ericsson AB. All Rights Reserved. Kernel November

Kernel Copyright Ericsson AB. All Rights Reserved. Kernel November Kernel Copyright 1997-2009 Ericsson AB. All Rights Reserved. Kernel 2.13.4 November 23 2009 Copyright 1997-2009 Ericsson AB. All Rights Reserved. The contents of this file are subject to the Erlang Public

More information

An introduction to Erlang & Elixir. Meetup October 28, Organized by Jean-François Cloutier Held at The Casco Bay Technology Hub, Portland, ME

An introduction to Erlang & Elixir. Meetup October 28, Organized by Jean-François Cloutier Held at The Casco Bay Technology Hub, Portland, ME An introduction to Erlang Elixir Meetup October 28, 2014 Organized by Jean-François Cloutier Held at The Casco Bay Technology Hub, Portland, ME Agenda Welcome! Why Erlang? Why Elixir? Getting Started Next

More information

Verification of Language Based Fault-Tolerance

Verification of Language Based Fault-Tolerance Verification of Language Based Fault-Tolerance Clara Benac Earle 1 and Lars-Åke Fredlund 2,3 1 Computing Laboratory, University of Kent, England 2 LSIIS, Facultad de Informática, Universidad Politécnica

More information

Last time: introduction. Networks and Operating Systems ( ) Chapter 2: Processes. This time. General OS structure. The kernel is a program!

Last time: introduction. Networks and Operating Systems ( ) Chapter 2: Processes. This time. General OS structure. The kernel is a program! ADRIAN PERRIG & TORSTEN HOEFLER Networks and Operating Systems (252-0062-00) Chapter 2: Processes Last time: introduction Introduction: Why? February 12, 2016 Roles of the OS Referee Illusionist Glue Structure

More information

Today: Fault Tolerance

Today: Fault Tolerance Today: Fault Tolerance Agreement in presence of faults Two army problem Byzantine generals problem Reliable communication Distributed commit Two phase commit Three phase commit Paxos Failure recovery Checkpointing

More information

Concurrency: what, why, how

Concurrency: what, why, how Concurrency: what, why, how May 28, 2009 1 / 33 Lecture about everything and nothing Explain basic idea (pseudo) vs. Give reasons for using Present briefly different classifications approaches models and

More information

Author: Paul Zenden. Hot-or-Not Elixir with José Valim

Author: Paul Zenden. Hot-or-Not Elixir with José Valim Author: Paul Zenden Hot-or-Not Elixir with José Valim > > elixir with {:ok, : José Valim }

More information

Kernel Copyright Ericsson AB. All Rights Reserved. Kernel 4.0 June 23, 2015

Kernel Copyright Ericsson AB. All Rights Reserved. Kernel 4.0 June 23, 2015 Kernel Copyright 1997-2015 Ericsson AB. All Rights Reserved. Kernel 4.0 June 23, 2015 Copyright 1997-2015 Ericsson AB. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License");

More information

CprE Fault Tolerance. Dr. Yong Guan. Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University

CprE Fault Tolerance. Dr. Yong Guan. Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University Fault Tolerance Dr. Yong Guan Department of Electrical and Computer Engineering & Information Assurance Center Iowa State University Outline for Today s Talk Basic Concepts Process Resilience Reliable

More information

Traditionally, a Web client sends an HTTP

Traditionally, a Web client sends an HTTP Editor: Steve Vinoski vinoski@ieee.org Server-Sent Events with Yaws Steve Vinoski Basho Technologies Traditionally, a Web client sends an HTTP request to a Web server and waits for a response. For many

More information