1 / 49

Ordering and Consistent Cuts in a Distributed System

This article discusses the concept of ordering events in a distributed system, including partial and total ordering, logical clocks, and anomalous behavior. It also explores the use of physical clocks for ordering events.

tnunez
Download Presentation

Ordering and Consistent Cuts in a Distributed System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ordering and Consistent Cuts Nicole Caruso Cornell University Dept. of Computer Science

  2. Time, Clocks, and theOrdering of Events in a Distributed System Leslie Lamport Stanford Research Institute Time, Clocks, and the Ordering of Events in a Distributed System

  3. About the Author Leslie Lamport Stanford Research Institute Time, Clocks, and the Ordering of Events in a Distributed System

  4. Introduction • Our concept of time • Distributed system’s concept of time Person Cars Observer Person Cars Observer See green light ? See green light Cross street Cross street Read news Readnews Time, Clocks, and the Ordering of Events in a Distributed System

  5. Introduction • Coordination of Distributed Systems • Lack of Understanding • Partial Ordering of Events • Total Ordering of Events Time, Clocks, and the Ordering of Events in a Distributed System

  6. Outline • Partial Ordering of Events • Logical Clocks • Total Ordering of Events • Anomalous Behavior • Physical Clocks Time, Clocks, and the Ordering of Events in a Distributed System

  7. Partial Ordering of Events • System Definition • System contains spatially separated processes • Process contains a sequence of events • Event manifestation is arbitrary, but must include message sending and message receiving Time, Clocks, and the Ordering of Events in a Distributed System

  8. Partial Ordering of Events • Mathematical Properties • Asymmetric • If a\<b, then b<a • If a\<b and b\<a, then a=b • Transitive • If a\<b and b\<c, then a\<c • Reflexive • a\<a Time, Clocks, and the Ordering of Events in a Distributed System

  9. Partial Ordering of Events • “Happened Before” Relation () • Asymmetric: If ab, then b\a • If a and b are in same process • abif a occurs before b • If a and b are in different processes • abif a is sending of message and b is receipt of message • If a is concurrent with b • a\b and b\a • Transitive:If aband bc, then ac • Reflexive: a\a Time, Clocks, and the Ordering of Events in a Distributed System

  10. Partial Ordering of Events • Typical Space-Time Diagram for a Distributed System Person Cars Observer See green light Cross street Readnews Time, Clocks, and the Ordering of Events in a Distributed System

  11. Outline • Partial Ordering of Events • Logical Clocks • Total Ordering of Events • Anomalous Behavior • Physical Clocks Time, Clocks, and the Ordering of Events in a Distributed System

  12. Logical Clocks • Process Clock Ci • Clock assigns number to event to represent time • Assigns Ci(a) to each event a within Pi • Belongs to one process Pi • System Clock C • Clock C(a) = Ci(a) Time, Clocks, and the Ordering of Events in a Distributed System

  13. Logical Clocks • Clock Condition: If ab, then C(a) < C(b) • If events a and b are in the same process Pi • Ci(a)<Ci(b) • if a occurs before b • If events a and b are in processes Pi and Pj • Ci(a)<Cj(b) • a is the sending of a message • b is the receipt of the message Time, Clocks, and the Ordering of Events in a Distributed System

  14. Outline • Partial Ordering of Events • Logical Clocks • Total Ordering of Events • Anomalous Behavior • Physical Clocks Time, Clocks, and the Ordering of Events in a Distributed System

  15. Total Ordering of Events • Total ordering eliminates concurrency • Identify message with event sending it • Following Example • Multiple processes compete for resource • Told from point of view of one process Pi Time, Clocks, and the Ordering of Events in a Distributed System

  16. Total Ordering of Events • Process Pi is granted resource • Request Tm:Pi • In Pi’s request queue • Time-stamped before other requests in the queue • Acknowledge Tm:Pi • Received from Pj • Time-stamped later than Request Tm:Pi Time, Clocks, and the Ordering of Events in a Distributed System

  17. Total Ordering of Events • Step 1: Pi Sends Request Resource • Pi sends Request Tm:Pito Pj • Pi puts Request Tm:Pi on its request queue T0:P1 T1:P1 P1 P2 P3 Time, Clocks, and the Ordering of Events in a Distributed System

  18. Total Ordering of Events • Step 1: Pi Sends Request Resource • Pi sends Request Tm:Pito Pj • Pi puts Request Tm:Pi on its request queue T0:P1 T1:P1 P1 request request T1:P1 T0:P1 P2 P3 Time, Clocks, and the Ordering of Events in a Distributed System

  19. Total Ordering of Events • Step 2: Pj Adds Message • Pj puts Request Tm:Pi on its request queue • Pj sends Acknowledgement Tm:Pj to Pi T0:P1 T1:P1 P1 P2 P3 T0:P1 T1:P1 Time, Clocks, and the Ordering of Events in a Distributed System

  20. Total Ordering of Events • Step 2: Pj Adds Message • Pj puts Request Tm:Pi on its request queue • Pj sends Acknowledgement Tm:Pj to Pi T0:P1 T1:P1 P1 ack ack T3:P3 T2:P2 P2 P3 T0:P1 T1:P1 Time, Clocks, and the Ordering of Events in a Distributed System

  21. Total Ordering of Events • Step 3: Pi Sends Release Resource • Pi removes Request Tm:Pi from request queue • Pi sends Release Tm:Pi to each Pj P1 P2 P3 T0:P1 T1:P1 Time, Clocks, and the Ordering of Events in a Distributed System

  22. Total Ordering of Events • Step 3: Pi Sends Release Resource • Pi removes Request Tm:Pi from request queue • Pi sends Release Tm:Pi to each Pj P1 release release T5:P1 T4:P1 P2 P3 T0:P1 T1:P1 Time, Clocks, and the Ordering of Events in a Distributed System

  23. Total Ordering of Events • Step 4: Pj Removes Message • Pj receives Release Tm:Pi from Pi • Pj removes Request Tm:Pi from request queue P1 P2 P3 Time, Clocks, and the Ordering of Events in a Distributed System

  24. Outline • Partial Ordering of Events • Logical Clocks • Total Ordering of Events • Anomalous Behavior • Physical Clocks Time, Clocks, and the Ordering of Events in a Distributed System

  25. Anomalous Behavior • Discrepancy between universe/system • Event sets and “happens before” relations PA PB PC PA PB PC b Universal Event Set S: ab System Event Set S: a\b and b\a a b a Time, Clocks, and the Ordering of Events in a Distributed System

  26. Anomalous Behavior • Strong Clock Condition • For events a and b in system event set S • If ab, Then C(a)<C(b) • Attainable via physical clocks Time, Clocks, and the Ordering of Events in a Distributed System

  27. Outline • Partial Ordering of Events • Logical Clocks • Total Ordering of Events • Anomalous Behavior • Physical Clocks Time, Clocks, and the Ordering of Events in a Distributed System

  28. Physical Clocks • Physical Clock Ci(t) • PC1 • к << 1 for all i: | dCi(t)/dt˗̶̵ 1 | < к • PC2 • ϵ for all i,j: | Ci(t)˗̶̵ Cj(t) | < ϵ • Also • µ< smallest transmission time Time, Clocks, and the Ordering of Events in a Distributed System

  29. Prevent anomalous behavior Must ensure that Cj(t) < Ci(t+µ) How small must к and ϵ be? ϵ/(1- к) < µ Physical Clocks Time, Clocks, and the Ordering of Events in a Distributed System

  30. Discussion • Partial ordering • Total ordering • Anomalous Behavior • Physical clocks Time, Clocks, and the Ordering of Events in a Distributed System

  31. Conclusions • Coordination of Distributed Systems • Partial Ordering of Events • Total Ordering of Events Time, Clocks, and the Ordering of Events in a Distributed System

  32. Distributed Snapshots:Determining Global States of Distributed Systems K. Mani Chandy University of Texas at Austin Leslie Lamport Stanford Research Institute Distributed Snapshots: Determining Global States of Distributed Systems

  33. Distributed Snapshots: Determining Global States of Distributed Systems K. Mani Chandy University of Texas at Austin About the Authors Leslie Lamport Stanford Research Institute

  34. Panoramic dynamic scene Cannot capture with single snapshot Must piece together multiple snapshots Questions How should snapshots be taken? What criteria must overall picture satisfy? Introduction Distributed Snapshots: Determining Global States of Distributed Systems

  35. Process can record its own state States of all processes form global state Record valid global system state Detect stable properties y(S) = true implies y(all states reachable from S) = true Introduction Distributed Snapshots: Determining Global States of Distributed Systems

  36. Distributed System Model Global State Detection Algorithm Recorded Global State Properties Stability Detection Outline Time, Clocks, and the Ordering of Events in a Distributed System

  37. Process State(t) Event(t) Channel MessagesSent(t) Event(t) Distributed System Model • Event • Process P • State S before • State S’ after • Channel C (incoming or outgoing from P) • Messages (received by P or sent from P) Distributed Snapshots: Determining Global States of Distributed Systems

  38. Example 1: Single Token System Distributed System Model States Global: in-P P : sI C : empty C’ : empty Q : sO States Global: in-C’ P : sO C : empty C’ : token Q : sO P P P P Q Q Q Q Event P sends States Global: in-C P : sO C : token C’ : empty Q : sO Event Q sends States Global: in-Q P : sO C : empty C’ : empty Q : sI Event Q receives Distributed Snapshots: Determining Global States of Distributed Systems

  39. Example 2: Nondeterministic System Distributed System Model P P P P Q Q Q Q States Global: S0 P : sI C : empty C’ : empty Q : sI States Global: S3 P : sI C : M C’ : empty Q : sO Event P sends M States Global: S1 P : sO C : M C’ : empty Q : sI Event Q sends M’ States Global: S2 P : sO C : M C’ : M’ Q : sO Event P receives M’ Distributed Snapshots: Determining Global States of Distributed Systems

  40. Distributed System Model Global State Detection Algorithm Recorded Global State Properties Stability Detection Outline Time, Clocks, and the Ordering of Events in a Distributed System

  41. Marker Sending Rule P records its state P sends marker along each outgoing channel C Marker Receiving Rule Q receives a marker along incoming channel C If Q has not recorded its state Q records its state Else Q records C’s state as a sequence of messages Algorithm Distributed Snapshots: Determining Global States of Distributed Systems

  42. Example: Process P ObtainsGlobal State from Process Q Q receives P’s marker along channel C Q records its state Computation Q receives P’s marker along channel C Q records C’s state Algorithm Distributed Snapshots: Determining Global States of Distributed Systems

  43. Distributed System Model Global State Detection Algorithm Recorded Global State Properties Stability Detection Outline Time, Clocks, and the Ordering of Events in a Distributed System

  44. Markers produce concurrent subsequence S* may not actually exist S* from combination of concurrent events No effect on preceding/following events S* reachable from Si So reachable from S* Recorded Global State Properties Time, Clocks, and the Ordering of Events in a Distributed System

  45. Theorem 1: Exists Computation {e0’...en’} Events { e0’ ... ei -1’ } is equivalent to { e0 ... ei -1 } { ei’ ... eo -1’ } is a permutation of { ei ... eo -1 } { eo’ ... en’ } is equivalent to { eo ... en } States { S0’ ... Si’ } is equivalent to { S0 ... Si } For some k, where i<k<o, Sk’ = S* { So’ ... Sn’ } is equivalent to { So ... Sn } Recorded Global State Properties Time, Clocks, and the Ordering of Events in a Distributed System

  46. Distributed System Model Global State Detection Algorithm Recorded Global State Properties Stability Detection Outline Time, Clocks, and the Ordering of Events in a Distributed System

  47. Algorithm Initialize: definite=false, y(Si)=definite Repeat: record S*, definite=y(S*) Implications of “definite” definite == false: no stable property at start definite == true: stable property at termination Correctness Sican lead to S*, S* can lead to So for all j: y(Sj) = y(Sj+1) Stability Detection Time, Clocks, and the Ordering of Events in a Distributed System

  48. Partial Ordering Recorded Global State Global State Detection Algorithm Stable Property Detection Discussion Time, Clocks, and the Ordering of Events in a Distributed System

  49. Processes form recorded global state Record its own state Piece together multiple records Questions addressed How should the snapshots be taken? What criteria must overall picture satisfy? Conclusions Time, Clocks, and the Ordering of Events in a Distributed System

More Related