Programming Distributed Erlang Applications: Pitfalls and Recipes + A More Accurate Semantics for Distributed Erlang Hans Svensson Chalmers University.

Slides:



Advertisements
Similar presentations
You have been given a mission and a code. Use the code to complete the mission and you will save the world from obliteration…
Advertisements

Using Matrices in Real Life
Advanced Piloting Cruise Plot.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Chapter 1 The Study of Body Function Image PowerPoint
Copyright © 2011, Elsevier Inc. All rights reserved. Chapter 6 Author: Julia Richards and R. Scott Hawley.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Copyright © 2010, Elsevier Inc. All rights Reserved Fig 2.1 Chapter 2.
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
Properties Use, share, or modify this drill on mathematic properties. There is too much material for a single class, so you’ll have to select for your.
UNITED NATIONS Shipment Details Report – January 2006.
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Jeopardy Q 1 Q 6 Q 11 Q 16 Q 21 Q 2 Q 7 Q 12 Q 17 Q 22 Q 3 Q 8 Q 13
Title Subtitle.
My Alphabet Book abcdefghijklm nopqrstuvwxyz.
0 - 0.
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
FACTORING ax2 + bx + c Think “unfoil” Work down, Show all steps.
Addition Facts
Year 6 mental test 5 second questions
Year 6 mental test 10 second questions
2010 fotografiert von Jürgen Roßberg © Fr 1 Sa 2 So 3 Mo 4 Di 5 Mi 6 Do 7 Fr 8 Sa 9 So 10 Mo 11 Di 12 Mi 13 Do 14 Fr 15 Sa 16 So 17 Mo 18 Di 19.
ZMQS ZMQS
Solve Multi-step Equations
Richmond House, Liverpool (1) 26 th January 2004.
REVIEW: Arthropod ID. 1. Name the subphylum. 2. Name the subphylum. 3. Name the order.
Data Structures Using C++
ABC Technology Project
Columbus State Community College
1 Undirected Breadth First Search F A BCG DE H 2 F A BCG DE H Queue: A get Undiscovered Fringe Finished Active 0 distance from A visit(A)
VOORBLAD.
15. Oktober Oktober Oktober 2012.
1 Breadth First Search s s Undiscovered Discovered Finished Queue: s Top of queue 2 1 Shortest path from s.
BIOLOGY AUGUST 2013 OPENING ASSIGNMENTS. AUGUST 7, 2013  Question goes here!
Factor P 16 8(8-5ab) 4(d² + 4) 3rs(2r – s) 15cd(1 + 2cd) 8(4a² + 3b²)
Squares and Square Root WALK. Solve each problem REVIEW:
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
1..
© 2012 National Heart Foundation of Australia. Slide 2.
Lets play bingo!!. Calculate: MEAN Calculate: MEDIAN
Understanding Generalist Practice, 5e, Kirst-Ashman/Hull
Chapter 5 Test Review Sections 5-1 through 5-4.
GG Consulting, LLC I-SUITE. Source: TEA SHARS Frequently asked questions 2.
Addition 1’s to 20.
25 seconds left…...
Slippery Slope
H to shape fully developed personality to shape fully developed personality for successful application in life for successful.
Januar MDMDFSSMDMDFSSS
Week 1.
Analyzing Genes and Genomes
We will resume in: 25 Minutes.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Intracellular Compartments and Transport
PSSA Preparation.
VPN AND REMOTE ACCESS Mohammad S. Hasan 1 VPN and Remote Access.
Immunobiology: The Immune System in Health & Disease Sixth Edition
Essential Cell Biology
Immunobiology: The Immune System in Health & Disease Sixth Edition
Chapter 30 Induction and Inductance In this chapter we will study the following topics: -Faraday’s law of induction -Lenz’s rule -Electric field induced.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2001 Chapter 16 Integrated Services Digital Network (ISDN)
CpSc 3220 Designing a Database
Traktor- og motorlære Kapitel 1 1 Kopiering forbudt.
Presentation transcript:

Programming Distributed Erlang Applications: Pitfalls and Recipes + A More Accurate Semantics for Distributed Erlang Hans Svensson Chalmers University of Technology Lars-Åke Fredlund Universidad Politécnica de Madrid Erlang Workshop, Freiburg, 5 Oct. 2007

Message passing guarantees Two Papers One Talk!? McErlang Pitfalls A More Accurate Semantics for Distributed Erlang A Semantics for Distributed Erlang Programming Distributed Erlang Applications: Pitfalls and Recipes Communicatio n with dead processes Dropping messages

Talking to the Dead N1N1 N2N2 P1P1 erlang:process_flag(trap_exit,true), Pid = spawn_link(N 2,m,addTwo,[]), -module(m). addTwo()-> receive {Pid,Num} -> Pid ! Num + 2 end, addTwo(). P2P2 Pid ! {self(),5}, receive N -> io:format(~p\n,[N]) end, {P 1,5} 5+2 7

Talking to the Dead N1N1 N2N2 P1P1 receive {EXIT,Pid,Reason} –> ok end, P2P2 {EXIT,P 2,terminated}

Talking to the Dead N1N1 N2N2 P1P1 -module(m2). mulTwo()-> receive {Pid,Num} -> Pid ! Num * 2 end, mulTwo(). ? Pid ! {self(),5}, receive N -> io:format(~p\n,[N]) end, {P 1,5} 10 5*2

Behind the scene N 2 was stopped and restarted A new process managed to get exactly the same pid Since the pid data structure is finite, this is expected, however… The magic number is 3! This feature can not be modeled even in the more accurate semantics

Losing messages N1N1 P1P1 N2N2 P2P2 snd(Pid,N)-> Pid ! N, io:format(~p,[N]), timer:sleep(5000), snd(Pid,N+1). rcv()-> receive N -> io:format(~p,[N]), end, rcv() …

Behind the scene N 1 and N 2 was disconnected and later reconnected Easily discovered by using links Never rely on distributed communication without supervision This scenario can be correctly modeled in the improved semantics

Distributed communication N1N1 P1P1 N2N2 P2P2 N3N3 P3P3 hello world hello world world hello

Distributed communication N1N1 P1P1 N2N2 P2P2 N3N3 P3P3 hello world P3P3 hello world

Behind the scene Only one (TCP-)connection between N 1 and N 2 A rather obscure guarantee Not recommended to exploit this guarantee in application, future runtime systems might break it This communication guarantee is not reflected in the semantics, there only the weaker guarantee holds

Practical considerations There is always a difference between any model and the actual runtime system Artifacts of the OTP implementation of the runtime system should not be exploited

Changes in the Semantics New rules for node disconnect Simplified rules for node failure and restart A more compact formulation of fairness Properties of the distributed semantics –Extension –Message reordering and node disconnect –Expressiveness –Finite systems stays finite

Survey!

Summary The possibility of reusing a Pid should not be neglected Distributed communication should always be supervised 3 is quite a small number, is it possible to use a larger number?

A message from Lars-Åke He is at home, working on a new runtime system He has not figured out the complete semantics, yet! Erik Hello world! (or will it be World Hello!)