1 / 17

TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM

TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM. L. Lamport Computer Science Laboratory SRI International. THE PAPER. Addresses the problem of clock drift in distributed systems Identify main function of computer clocks to order events

jana
Télécharger la présentation

TIME, CLOCKS AND THE ORDERING OF EVENTS 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. TIME, CLOCKS AND THE ORDERING OF EVENTS IN A DISTRIBUTED SYSTEM L. Lamport Computer Science LaboratorySRI International

  2. THE PAPER • Addresses the problem of clock drift in distributed systems • Identify main function of computer clocks to order events • Indicates which conditions clocks must satisfy to fulfill their role • Introduces logical clocks

  3. ORDERING EVENTS • Event ordering linked with concept of causality: • Saying that event a happened before event b is same as saying that event a could have affected the outcome of event b • If events a and b occur on processes that do not exchange any data, their exact ordering is not important

  4. Relation “has happened before” (I) • Smallest relation satisfying the three conditions: • If a and b are events in the same process and a comes before b, then ab • If a is the sending of a message by a process and b its receipt by another process then ab • If ab and b c then ac

  5. Process i Process k Process j Example (I) d a X X c e X X b X

  6. Example (II) • From first condition • ad • ce • From second condition • ac • be • From third condition • ae

  7. Relation “has happened before” (II) • We cannot always order events: relation “has happened” before is only a preorder • If a did not happen before b, it cannot causally affect b

  8. Logical clocks • Verify the clock condition: if ab then C<a> <C<b> and the two subconditions: • if a and b are events in process Pi and a comes before b, then Ci<a> <Ci<b> • if a is the sending of a message by Pi and b its receipt by Pj then Ci<a> <Cj<b>

  9. Implementation rules • Each process Pi increments its clock Ci between two consecutive events, • If a is the sending of a message m by Pi then m includes a timestamp Tm = Ci<a> when Pj receives m, it sets its clock to a value greater than or equal to its present value and greater than Tm

  10. Defining a total order • We can define a total ordering on the set of all system events a b if either Ci<a> < Cj<b> or Ci<a> = Cj<b> and Pi < Pj • This ordering is not unique

  11. Anomalous behaviors • Logical clocks have anomalous behaviorsin the presence of outside interactions • Carrying a flash drive from one machine to another • Dictating file changes over the phone • Must use physical clocks

  12. Process i Process k Process j Example d a X X outside interaction c e X X b X

  13. Strong clock condition • Let S be set of all systems events plus the relevant external events • For all events a, b inS, if ab then C(a) <C(b)

  14. Physical clock conditions • There is a constant  << 1 such that for all i: |d Ci(t)/dt - 1| < The clock is neither too fast nor too slow • There is a constant  such that for all i, j: |Ci(t) - Cj(t)| < The clocks are more or less synchronized

  15. Implementation rules • If Pi does not receive a message at time tthen Ci(t) is differentiable and dCi(t)/dt> 0 • If Pi sends message m at time tthen m includes a timestamp Tm = Ci(t) When Pj receives m at time t’,it sets Cj(t’) to maximum of Cj(t’-0) and Tm+m,where m is the minimum transmission delay

  16. Observations • Like logical clocks, physical clocks cannot be rolled back • Required accuracy of a given physical clock depends on the minimum transmission delay of outside interactions • If it takes 20 minutes to carry a flash drive between two machines, their clocks can beoff by up to 20 minutes

  17. Process i Process j Example d 11:30 am X X OK NO 11:15 am 11:30 am X X

More Related