MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the...

91
MAD lessonsModels & Algorithms for Distributed algorithms/systems/Emmanuelle Anceaume, CNRS, Cidre team Eric Fabre, INRIA, SuMo team h@p://people.rennes.inria.fr/Eric.Fabre/ 1

Transcript of MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the...

Page 1: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

MADlessons…

Models&AlgorithmsforDistributed

algorithms/systems/…

EmmanuelleAnceaume,CNRS,CidreteamEricFabre,INRIA,SuMoteam

h@p://people.rennes.inria.fr/Eric.Fabre/

1

Page 2: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Overallcontents

•  IntroducGontodistributedsystems/algos(today)•  Formalmethodsfordistributedsystems(4lessons)

-  asynchrony,runsasparGalordersofevents-  modelsforsuchsystems,withtrueconcurrencysemanGcs-  simpleverificaGonproblems

•  Distributedalgorithms(5lessons)-  featuresoftheBitCoinandoftheBlockChain

•  Therewillbeconcurrentteaching!(=overlappingofthetwothreads)

2

Page 3: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Whatisitabout?

“Adistributedsystemisoneinwhichthefailureofacomputeryoudidn'tevenknowexistedcanrenderyourowncomputerunusable.”

[LeslieLamport]

LeslieLamportTuringAward2013

forhiscontribuGonstodistributedsystems

AdistributedsystemisamulGprocessorsysteminwhichtheGmerequiredforinterprocesscommunicaGonislargecomparedtotheGmeforeventswithinasingleprocessor–inotherwords,ittakeslongerforinterprocesscommunicaGonthanitdoesforaprocesstolookatitsownmemory.

3

Page 4: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

“theyareeverywhere…”

•  Distributedsocware-  onlinebusinesses:comparing,selecGng,paying,shipping-  dynamicwebpagebuilding:socialnetworks,mashups,…-  searchengines:map-reduce-  distributeddatabases:concurrentaccess,consistency,atomicityof

operaGonsandoftransacGons-  cooperaGvework:shareddocuments,jointediGng,SVNs,GitHub-  P2P:distributedstorage,bitcoin-  onlinemulG-playergames-  …

4

Page 5: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

“theyareeverywhere…”

•  modernOS-  mulG-coreprocessors-  mulG-processors+asynchronousbuses

(ex.incars,planes,…):GALS-  bytecodeproducedbysomecompilers,

introducingparallelism-  mulG-threadsprogramming

•  system-  computergrids-  cloudcompuGng,connectedvirtual

machines,connectedcontainers(Docker):dynamicity

-  powergrids

5

Page 6: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

“theyareeverywhere…”

•  telecommunicaGonnetworks-  rouGngalgorithms(OSPF):dynamicity,resilience-  cellularnetworks:accesstosharedresources-  adhocnetworks:fullydecentralized,dynamicity-  delaytolerantnetworks-  socwaredefinednetworks-  IoT:InternetofThings,connectedobjects-  …

•  physicalsystems-  sensornetworks-  autonomousrobotnetworks:exploraGon-  UAVformaGonflight:consensusproblems,

distributedcontrol-  autonomousvehicles:cars,shu@les,

trains,subways-  IoT:massivelydistributedsensornetworks-  RFIDnetworks… 6

Page 7: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

“theyareeverywhere…”

•  humanorganizaGons-  distributedmanufacturing-  mulG-agentsorganizaGons:hospital,crisismanagement?-  distributeddatacollecGon:Wikipedia,epidemysurveillanceand

reporGng-  socialbehaviors:gossipspreading,diseasedisseminaGon-  non-human:ant/beecolonies-  …

7

Page 8: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Interestandchallenges

•  whydistributedsystems?-  someproblemsareintrinsicallydistributed:inspace,amongagents-  needtoaccesssharedresources(bandwidth,database)-  needtojoinforcesforacommongoal-  moreefficiency/performance:compuGngpower,storage,faster

processing(parallelism)-  be@errobustness:redundancyofresources,resistancetofailures

(storage,cloudcompuGng),be@erperformance/costraGo-  scalability:ondemandperformance,easytoup-scale,opento

numeroususers,distributedmanagement

•  challenges-  faulttolerance,resilience,resistancetodynamicity-  management(security,control,diagnosis,performance,upgrade…)-  design(correctness/debug)-  dedicatedalgorithms(impossibilityresults)

8

Page 9: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Whoworksonthetopic?

•  distributedcompuGng–  architecture,cloudcompuGng,networks

•  distributedalgorithms-  algorithmicsfocusedonDS(feasibility,complexity)-  basicservices(mutualexclusion,elecGon,consensus…)-  specificelaboratealgorithms(gossip,rouGng,control,planning…)

•  distributedprogramming-  languagesandprogrammingprinciplesforDS

•  distributedsystems-  howtobuildthem(grids,clouds,SDN,mulG-cores,…)-  formalmethods(gametheory,verificaGon,concurrencymodels,

test,diagnosis,control…) 9

Page 10: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Firstmodels

Defini2on:adistributedsystemisanetworkofautonomousmachines/socwares/processes/enGGes,withacoordinaGonmiddleware,designedtobehaveasasinglemachineFeatures:

-  noglobalGme,onlylocalGmeincomponents-  communicaGonGme>>localcompuGngGme-  ocenrepresentedasanundirectedgraphG=(V,E)-  nodes/machines:generallyinfinitestatemachines,cancrash,join,

leave,lie(malicious)-  comm.bymessages,viachannels(FIFO/LIFO,(un)boundedinGme

andsize,losslessornot,reliableornot…)-  nodesgenerallyhavealocalknowledgeofthesystemtopology(i.e.

portstoneighbors)

10

Page 11: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Simplemodel:afiniteundirectedgraph,nodes/verGcesareprocesses,edgesarebidirecGonalcommunicaGonchannelsThetopologyisfixed,butarbitrary,locallyknown(eachnodeknowshowmanyneighborsithas).Messagesarereliablytransmi@edthroughFIFOchannels,withdelay.

centralizedse9ng1component1controlpoint

1processsimplefailures

synchronous=globalclockclosed/fixedarchitecture

distributedse9ngseveralcomponentsseveralcontrolpoints

severalprocesses,messagescomplex/mulGplefailures

asynchronous=noglobalGmeopen/changingarchitecture

11

Page 12: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Somebasicservicestoachieve•  elecGon

–  nodesmustagreeononeofthemastheirleader•  consensus

–  eachnodeproposesavalue;nodesmustagreeononeofthesevalues•  mutualexclusion

-  notwonodescanperformsomedangerousacGonatthesameGme-  allofthemgetequalchancetoperformthisacGon

•  recoveringeventcausality-  idenGfycausalpastofanevent;idenGfypossiblereorderings

•  definiGonofsnapshots-  buildrecoverypointsfordistributedcomputaGons(failureprotecGon)

•  atomicbroadcast-  guaranteethatbroadcastsarereceivedinthecorrectorder,despitecrashes

•  autostabilizingalgorithms-  convergetoadesiredproperty(ex.asingletokeninaring)

•  detecGonofstableproperGes-  ex.detectthatadistributedexecuGonhasterminated(nopendingmessage)

12

Page 13: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Synchronousvsasynchronous

•  Asynchronous–  localcomputaGonGme<<communicaGonGme–  noglobalclock

•  Synchronous–  communicaGonGme<<computaGonGme

orcommunicaGonGmeisbounded–  globalGmecanbesimulated(butitisnotalwaysrelevant)

Inthesynchronouscase–  processescanwaitforallmessagestobereceived–  theycandetectmsglossesandprocesscrashes–  computaGonsaregenerallyorganizedinrounds

•  allprocessescompute•  allprocessesexchangemessages

–  Gmecomplexityofanalgo.isexpressedinnumberofrounds13

Page 14: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Synchronousalgorithms

1.Leaderelec2ononaringassump2ons-  processesrunthesamecode-  localknowledge:nodesonlyseeportstotheirneighbors-  portnumbersaresymmetricbytranslaGononthering-  onlyonenodemustoutput“leader”,theothermustoutput“non-

leader”(ingeneral,theyshouldalsoknowwhoistheleader)

Proof:bycontradicGonusingsymmetry•  theexecuGononeachnodeisthesame(samestatereached,same

messagessent,samereacGontomessages)•  bysymmetry,ifnodeioutputs“leader”,thenallnodesoutput

“leader”

Thm:thereexistsnosynchronousalgorithmonaringwithndeterminisGcindisGnguishableprocessesthatsolvestheleaderelecGonproblem.

14

Page 15: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Synchronousalgorithms

1.Leaderelec2ononaringassump2ons-  processesrunthesamecode-  localknowledge:nodesonlyseeportstotheirneighbors-  portnumbersaresymmetricbytranslaGononthering-  onlyonenodemustoutput“leader”,theothermustoutput“non-

leader”(ingeneral,theyshouldalsoknowwhoistheleader)

Thm:thereexistsnosynchronousalgorithmonaringwithndeterminisGcindisGnguishableprocessesthatsolvestheleaderelecGonproblem.

Proof:bycontradicGonusingsymmetry•  theexecuGononeachnodeisthesame(samestatereached,same

messagessent,samereacGontomessages)•  bysymmetry,ifnodeioutputs“leader”,thenallnodesoutput

“leader”

15

Page 16: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Solu2on:breakthesymmetry!–  adduniqueidenGfiers(UID)tonodes–  allowforrandomness(withdifferentseedsateachnode)

Withuniqueiden2fiers–  eachprocesssendsitsid.toneighbours–  eachprocessreceivesidsfromitsneighbors,computesthemaximal

UIDreceivedsofar,andpropagatesittoneighbors–  diffusionprocess–  Q:whatisagoodstoppingcriterion?

1

49

3

67

16

Page 17: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

1

4

7

9

3

6

97

779

9Solu2on:breakthesymmetry!–  adduniqueidenGfiers(UID)tonodes–  allowforrandomness(withdifferentseedsateachnode)

Withuniqueiden2fiers–  eachprocesssendsitsid.toneighbours–  eachprocessreceivesidsfromitsneighbors,computesthemaximal

UIDreceivedsofar,andpropagatesittoneighbors–  diffusionprocess–  Q:whatisagoodstoppingcriterion?

17

Page 18: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

1

4

7

9

3

6

99

799

9Solu2on:breakthesymmetry!–  adduniqueidenGfiers(UID)tonodes–  allowforrandomness(withdifferentseedsateachnode)

Withuniqueiden2fiers–  eachprocesssendsitsid.toneighbours–  eachprocessreceivesidsfromitsneighbors,computesthemaximal

UIDreceivedsofar,andpropagatesittoneighbors–  diffusionprocess–  Q:whatisagoodstoppingcriterion?

18

Page 19: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Solu2on:breakthesymmetry!–  adduniqueidenGfiers(UID)tonodes–  allowforrandomness(withdifferentseedsateachnode)

Withuniqueiden2fiers–  eachprocesssendsitsid.toneighbours–  eachprocessreceivesidsfromitsneighbors,computesthemaximal

UIDreceivedsofar,andpropagatesittoneighbors–  diffusionprocess–  Q:whatisagoodstoppingcriterion?

Withrandomness–  eachprocessdrawsanid.atrandominset{1,2,…,r}–  thenrunsthepreviousalgorithm–  Rem:seedsoftherandomnumbergeneratorsarealsoidenGfiers…

1

4

9

9

3

6

14

963

9

19

Page 20: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

HowmanyUIDsdoweneed?howlargeshouldbe{1,2,…,r}comparedtothenumberofnodesn?Lemma:with,theprobabilitythattwoprocessesoutofndrawthesameidenGfierislessthan✏

r = n2/✏

Proof1nboffavorablecases=totalnbofcases=probabilitytowin=withonehas

r(r � 1)...(r � n+ 1) =r!

n!rn

p =r

r

(r � 1)

r...(r � n+ 1)

r>

✓r � n

r

◆n

r = n2/✏ p > (1� ✏/n)n = 1� n · ✏/n+ ... > 1� ✏

Proof2probabilitythattwoprocessespickthesameUID=1/runionbound:probabilitytolose<sum1/roverallpossiblepairsthisis

n(n� 1)

2r= ✏

n� 1

2n< ✏/2

20

Page 21: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

2.Maximalindependencesetassump2ons-  graphofnprocesses,notnecessarilyconnected-  MIS=maximalsubsetofnodesthatarepairwisedisconnected-  processesdon’thaveuniqueids,sotheproblemisunsolvablein

somegraphs(seeelecGonthm):weuserandomnesstobreaksymmetry

-  eachprocessshouldoutput“in”or“out”

21

Page 22: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Lubi’salgorithm:alterna2onof2rounds,amongac2venodesRound1-  eachnodeupicksanumberx(u)atrandom,

thensendsittoallitsneighborsinN(u)[denotestheneighborset]-  eachnodereceivesmessagesfromallitsneighbors-  ifnodeuhasthelargestvalue:x(u)>x(v)forvinN(u)

thenitjoinstheMISandoutputs“in”

Round2-  eachnodeujoiningtheMISsendsmessage“in”toitsneighbors-  eachnodevreceivingmessage“in”fromaneighbormustnotjoin

theMIS,andoutputs“out”-  eachnodehavingdecidedeither“in”or“out”becomesinacGve

Rounds1and2proceedunGlallnodesareinacGve(i.e.havedecidedwhethertheyareinorout)

22

Page 23: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

3 12

15

4

8

15

27

911

6

23

Page 24: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

3 12

15

4

8

15

27

911

6

24

Page 25: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

3 12

15

4

8

15

27

911

6

25

Page 26: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

8

129

26

Page 27: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

8

129

27

Page 28: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

8

129

28

Page 29: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

ProofofLubi’salgorithmideas:–  findandproveinvariantsthatarepreservedbyeachround–  proveamonotonyproperty(forconvergence)Invariant:thenodesthatjoinedtheMIScan’tbeconnectedMonotony:thenumberofacGvenodesdecreasesQ:decreasesstrictly?A:yes,unlessiftwo(ormore)nodespickthesamemaximalvalue,whichisunlikely(seepreviouslemma).OnecanactuallyshowthattheaveragenumberofacGveedgesisatleastdividedby2ateachphase.Maximality:onlyinacGvenodescouldbeaddedtothecurrentMIS,soifallnodesareinacGveatterminaGon,theMISismaximal

29

Page 30: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

3.Spanningtreeconstruc2onassump2ons–  finiteconnectedgraphG=(V,E),unknownsizeandtopology–  adisGnguishedvertexr,calledtheroot–  nodeshaveuniqueidenGfiers(UID)–  localknowledgeoftopology(nodesknowtheirneighbors’UIDs)goal–  processesmustbuildaspanningtree,rootedatr–  theuniquepathfromnodertoeachnodevmustbeashortest

path(innumberofedges)–  eachnodev(exceptr)shouldoutputparent(v),possiblychildren(v)

r

30

Page 31: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Algorithm:principle=diffusionfromrootnoderini2aliza2on–  allnodesinacGve,exceptr–  roundk•  ifnodevisacGve

-  vsends“search”messagetoallitsneighbors,excepttoitsparent-  thenvbecomesinacGve

•  ifnodevreceivesoneormore“search”messagesanddoesnotyethaveaparent-  vselects(nondeterminisGcally)onesenderuandsets-  vmayinformuthatitisitschild-  vbecomesacGve

8v 2 V, parent(v) = ;

parent(v) = u

31

Page 32: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

32

Page 33: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r search

33

Page 34: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r search

34

Page 35: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r search

35

Page 36: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r search

36

Page 37: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

37

Page 38: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

38

Page 39: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

39

Page 40: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

search search

40

Page 41: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

search search

41

Page 42: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

42

Page 43: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

43

Page 44: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

searchsearchsearch

44

Page 45: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

searchsearchsearch

45

Page 46: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

46

Page 47: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

47

Page 48: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

48

Page 49: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

49

Page 50: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Algorithm:principle=diffusionfromrootnoderini2aliza2on–  allnodesinacGve,exceptr–  roundk•  ifnodevisacGve

-  vsends“search”messagetoallitsneighbors,excepttoitsparent-  thenvbecomesinacGve

•  ifnodevreceivesoneormore“search”messagesanddoesnotyethaveaparent-  vselects(nondeterminisGcally)onesenderuandsets-  vmayinformuthatitisitschild-  vbecomesacGve

proofinvariant(+monotony)•  theselectededgesformatree•  atroundk,allnodesatdistancekfromrootrhavebeenreachedand

connectedbyauniquepathoflengthk

8v 2 V, parent(v) = ;

parent(v) = u

50

Page 51: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Algorithm:principle=diffusionfromrootnoderini2aliza2on–  allnodesinacGve,exceptr–  roundk•  ifnodevisacGve

-  vsends“search”messagetoallitsneighbors,excepttoitsparent-  thenvbecomesinacGve

•  ifnodevreceivesoneormore“search”messagesanddoesnotyethaveaparent-  vselects(nondeterminisGcally)onesenderuandsets-  vmayinformuthatitisitschild-  vbecomesacGve

Remarks–  non-determinismdoesnotpreventcorrectbehavior–  cancomputeaswellthedistanceofeachnodetotheroot–  terminaGoniseasytodetect:backpropagaGonfromtheleaves

•  leafnodesstarttellingtheirparentthattheyare“done”•  aninnernodereceivinga“done”messagefromallitschildrenpropagates

“done”toitsparent•  oncetherootnodereceives“done,”itbroadcastsitdownthetreetoallnodes

8v 2 V, parent(v) = ;

parent(v) = u

51

Page 52: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Algorithm:principle=diffusionfromrootnoderini2aliza2on–  allnodesinacGve,exceptr–  roundk•  ifnodevisacGve

-  vsends“search”messagetoallitsneighbors,excepttoitsparent-  thenvbecomesinacGve

•  ifnodevreceivesoneormore“search”messagesanddoesnotyethaveaparent-  vselects(nondeterminisGcally)onesenderuandsets-  vmayinformuthatitisitschild-  vbecomesacGve

Extension:Bellman-Fordalgorithm(dynamicprogramming)–  computesashortestpathtreerootedatr,whenedgeshavealength–  searchmessagesmustcarryaswelladistancetor–  nodesreceivingashorterdistancemessagegetreacGvated

andchangetheirparentoneclosertor

8v 2 V, parent(v) = ;

parent(v) = u

52

Page 53: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Asynchronousalgorithms

changes–  norounds,muchmorenon-determinism–  processescomputeandcommunicatearbitrarily(atomicacGons)–  correctnessandconvergencemustbeprovedforamuchlargerand

complexsetofexecuGonsse9ng

–  G=(V,E)undirectedgraph,V=processes,E=bidirecGonalchannels–  processesneednotbedisGnguishable,knowlocalportsto

neighbours,(infinite)statemachines–  communicaGonbylosslessFIFOchannels(unbounded)–  Cu,visthechannel(buffer)fromutov–  primiGvessendu,v(m),receiveu,v(m)

53

Page 54: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

1.Spanningtreeconstruc2onassump2ons–  finiteconnectedgraphG=(V,E),unknownsizeandtopology–  adisGnguishedvertexr,calledtheroot–  nodeshaveuniqueidenGfiers(UID)–  localknowledgeoftopology(nodesknowtheirneighbors’UIDs)

goal–  processesmustbuildaspanningtree,rootedatr–  theuniquepathfromnodertoeachnodev

isnotrequestedanymoretobeashortestpath(innumberofedges)–  eachnodev(exceptr)shouldoutputparent(v),possiblychildren(v)

54

Page 55: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

1.Spanningtreeconstruc2onidea:taketheprevioussynchronousalgo,makeitasynchronous!Algorithm:principle=diffusionfromrootnoderini2aliza2on–  allnodesinacGve,exceptr–  stepk:dooneofthetwoacGonsbelow•  emissionfromanacGvenodev

-  vsends“search”messagetoallitsneighbors,excepttoitsparent-  thenvbecomesinacGve

•  recepGonofa“search”messagebynodevfromnodeuifnodevdoesnotyethaveaparent-  vselectssetsuasitsparent:-  vmayinformuthatitisitschild-  vbecomesacGveotherwisedonothing

8v 2 V, parent(v) = ;

parent(v) = u

55

Page 56: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

56

Page 57: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r search

57

Page 58: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

58

Page 59: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

59

Page 60: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

60

Page 61: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

61

Page 62: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

62

Page 63: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

63

Page 64: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

64

Page 65: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

65

Page 66: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

search

66

Page 67: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

67

Page 68: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

68

Page 69: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

search

search

69

Page 70: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

70

Page 71: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

71

Page 72: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

search

72

Page 73: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search

73

Page 74: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

search search

74

Page 75: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r

75

Page 76: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

2.AsynchronousBellman-Fordcontextandgoal

•  undirectedconnectedgraphG=(V,E)•  posiGveweightsw(e)onedges,orw(u,v)onedge(u,v)•  disGnguishedrootnoder•  computeashortestpathfromrtoanynode

mainidea•  extensionofspanningtreeconstrucGontomindistancecomputaGon:

Bellman-Ford(withreacGvaGonofnodes)•  desynchronizaGon

76

Page 77: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Algorithm:principle=diffusion+distancecomputaGonfromrootnoder,thenfromallupdatednodesini2aliza2on–  allnodesinacGve,exceptr–  distancestotherootnoder

stepk:dooneofthetwoacGonsbelow•  emissionfromanacGvenodeu

-  usendsmessagetoallitsneighborsv,excepttoitsparent-  thenubecomesinacGve

•  recepGonofamessagembynodevfromnodeu•  ifnodevdoesnotyethaveaparentorifthepaththroughuisshorter:

-  vupdatesitsdistance:-  vselectssetsuasitsparent:-  vmayinformuthatitisitschild(anditsformerparentthathelec…)-  vbecomesacGve

•  otherwisedonothing(messagemconsumedwithnoimpact)

parent(v) = u

8v 2 V, parent(v) = ;, dist(v) =?dist(r) = 0

dist(v) := m+ w(u, v)dist(v) > m+ w(u, v)

m = dist(u)

77

Page 78: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

78

Page 79: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

0

79

Page 80: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

80

Page 81: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

6

132

81

Page 82: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

6

132

12

10

7

82

Page 83: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

12

10

7

3

83

Page 84: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

12

8

7

3

14

4

84

Page 85: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

11

8

6

3

14

4

85

Page 86: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

11

7

6

3

13

4

86

Page 87: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

11

7

6

3

5

4

87

Page 88: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

7

7

6

3

5

4

88

Page 89: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

r1

12

5

6

31

11

1

11

4

9

3

2

0

1

5

52

7

7

6

3

5

4

89

Page 90: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

remarkonecanassumethatmessagespileupintochannels,orthatthelastmessageerasesthepreviousoneproof:invariant(s)–  currentstructureisalwaysatree–  distanceofnodevistheshortestonsomepathfromrtov,andthe

parentofvisthepredecessorofvonthatpath–  distanceofnodevtotherootnoderistheshortestamongpaths

exploredbythemessagesthatreachedvsofarmonotony–  distancesatnodesdecrease,boundedfrombelowbytrueshortest

distances–  thereisatleastoneshortestpathtoanodethatwillbeprogressively

acGvated(allnodesarereached)

complexity?i.e.howmanysuccessiveelementarysteps?–  homework…–  hint:each(re)acGvatednodemay(re)iniGateamessageflowonthe

wholegraph

90

Page 91: MAD lessons - Inriapeople.rennes.inria.fr/Eric.Fabre/Papiers/Mad Intro.pptx.pdfSoluon : break the symmetry ! – add unique idenGfiers (UID) to nodes – allow for randomness (with

Takehomemessages

distributedsystems•  areeverywhereinmoderncomputerscience•  requiredifferentmodels/assumpGonstobecorrectlydescribed/analyzed

amajorphenomenonisasynchrony•  duetotheabsenceofaglobalclock•  itbecomesnecessarytomodelandunderstandtheconcurrencyofevents•  thismakesthestudyofalgorithms/systemsmuchmoreinvolved

next2me•  representaGonofrunsasparGalordersofevents•  vectorclocks•  snapshotalgorithms

91