time logical time and causality
play

Time, Logical Time and Causality Carlos Baquero Distributed Systems - PowerPoint PPT Presentation

Time, Logical Time and Causality Carlos Baquero Distributed Systems Group Universidade do Minho Time, Logical Time and Causality Carlos Baquero Distributed Systems Group Universidade do Minho MAPI 2007 Plan Time, Logical Time and


  1. Time Synchronization Summary Time, Logical Time and Causality Carlos Baquero Distributed Both in synchronous and asynchronous settings one can expect Systems Group Universidade do at most time synchronization in an envelope D . Synchronization Minho can be usefull to coordinate access to shared channels; either to avoid two senders at the same time or to make shure that sender and receiver are both awake.

  2. Time Synchronization Summary Time, Logical Time and Causality Carlos Baquero Distributed Both in synchronous and asynchronous settings one can expect Systems Group Universidade do at most time synchronization in an envelope D . Synchronization Minho can be usefull to coordinate access to shared channels; either to avoid two senders at the same time or to make shure that sender and receiver are both awake. With enough timing resolution, tight envelopes, and slow computation steps (or slow processors) one could expect to tottaly order a distributed computation.

  3. Time Synchronization Summary Time, Logical Time and Causality Carlos Baquero Distributed Both in synchronous and asynchronous settings one can expect Systems Group Universidade do at most time synchronization in an envelope D . Synchronization Minho can be usefull to coordinate access to shared channels; either to avoid two senders at the same time or to make shure that sender and receiver are both awake. With enough timing resolution, tight envelopes, and slow computation steps (or slow processors) one could expect to tottaly order a distributed computation. The resulting total order is not realistic and not always usefull, since it orders events that are in fact unrelated.

  4. Time Synchronization Summary Time, Logical Time and Causality Carlos Baquero Distributed Both in synchronous and asynchronous settings one can expect Systems Group Universidade do at most time synchronization in an envelope D . Synchronization Minho can be usefull to coordinate access to shared channels; either to avoid two senders at the same time or to make shure that sender and receiver are both awake. With enough timing resolution, tight envelopes, and slow computation steps (or slow processors) one could expect to tottaly order a distributed computation. The resulting total order is not realistic and not always usefull, since it orders events that are in fact unrelated. Even on physical systems real time total ordering is not always consistent for diferent observers.

  5. � � � � Time Synchronization Ordering Explosions: Two independent ones Time, Logical Time and A ∢ B ∢ C Causality � � � � � � � � � Carlos Baquero � � � � � Distributed � � � � � Systems Group � � � � � � Universidade do � ⋆ � B � Minho � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � C ⋆ � � � � � � � � � � � � � � � � � � � � � � � � � � � D ∢ C ∢ B Observers While A sees � B , C � , D sees � C , B � .

  6. � � � � Time Synchronization Ordering Explosions: Two independent ones Time, Logical Time and A ∢ B ∢ C Causality � � � � � � � � � Carlos Baquero � � � � � Distributed � � � � � Systems Group � � � � � � Universidade do � ⋆ � B � Minho � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � C ⋆ � � � � � � � � � � � � � � � � � � � � � � � � � � � D ∢ C ∢ B Observers While A sees � B , C � , D sees � C , B � . If we really need a total order (e.g. to make a replicated state machine) maybe we can give an arbitrary order to these events. As long as no one can contradict these decisions.

  7. � � � � Time Synchronization Ordering Explosions: One triggers the next Time, Logical Time and A ∢ B ∢ C Causality � � � � � � � Carlos Baquero � � � � � � Distributed � � � � � Systems Group � � � � Universidade do � � ⋆ B � Minho � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ∢ B ⋆ C � � � � � � � � � � � � � � � � � � � � � � � � � � � D ∢ B ∢ C Observers Now, both A and D see � B , C � .

  8. � � � � Time Synchronization Ordering Explosions: One triggers the next Time, Logical Time and A ∢ B ∢ C Causality � � � � � � � Carlos Baquero � � � � � � Distributed � � � � � Systems Group � � � � Universidade do � � ⋆ B � Minho � � � � � � � � � � � � � � � � � � � � � � � � � � � � � ∢ B ⋆ C � � � � � � � � � � � � � � � � � � � � � � � � � � � D ∢ B ∢ C Observers Now, both A and D see � B , C � . If message propagation speed is uniform, independent observers make consistent observations of events that might be causaly related. Otherwise the world would be much more confusing . . .

  9. Order Relations Time, Logical Time and Causality Carlos Baquero Before digging deeper into order in distributed systems lets review Distributed Systems Group some notions of order relations. Universidade do Minho Order Concerns the comparison between pairs of objects.

  10. Order Relations Time, Logical Time and Causality Carlos Baquero Before digging deeper into order in distributed systems lets review Distributed Systems Group some notions of order relations. Universidade do Minho Order Concerns the comparison between pairs of objects. Is a binary relation on a set of objects. In order � B , < B � we have < B ⊆ B × B .

  11. Order Relations Time, Logical Time and Causality Carlos Baquero Before digging deeper into order in distributed systems lets review Distributed Systems Group some notions of order relations. Universidade do Minho Order Concerns the comparison between pairs of objects. Is a binary relation on a set of objects. In order � B , < B � we have < B ⊆ B × B . Order is transitive. a < b ∧ b < c ⇒ a < c .

  12. Order Relations Time, Logical Time and Causality Carlos Baquero Before digging deeper into order in distributed systems lets review Distributed Systems Group some notions of order relations. Universidade do Minho Order Concerns the comparison between pairs of objects. Is a binary relation on a set of objects. In order � B , < B � we have < B ⊆ B × B . Order is transitive. a < b ∧ b < c ⇒ a < c . Order is antisymmetric. a < b ⇒ b � < a .

  13. Order Relations Time, Logical Time and Causality Carlos Baquero Before digging deeper into order in distributed systems lets review Distributed Systems Group some notions of order relations. Universidade do Minho Order Concerns the comparison between pairs of objects. Is a binary relation on a set of objects. In order � B , < B � we have < B ⊆ B × B . Order is transitive. a < b ∧ b < c ⇒ a < c . Order is antisymmetric. a < b ⇒ b � < a . If we miss antisymmetry we only have a preorder .

  14. Order Relations Time, Logical Time and Causality Carlos Baquero Before digging deeper into order in distributed systems lets review Distributed Systems Group some notions of order relations. Universidade do Minho Order Concerns the comparison between pairs of objects. Is a binary relation on a set of objects. In order � B , < B � we have < B ⊆ B × B . Order is transitive. a < b ∧ b < c ⇒ a < c . Order is antisymmetric. a < b ⇒ b � < a . If we miss antisymmetry we only have a preorder . Orders can be strict < or non-strict ≤ .

  15. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho

  16. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x .

  17. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x . antisymmetry x ≤ y and y ≤ x imply x = y .

  18. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x . antisymmetry x ≤ y and y ≤ x imply x = y . transitivity x ≤ y and y ≤ z imply x ≤ z .

  19. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x . antisymmetry x ≤ y and y ≤ x imply x = y . transitivity x ≤ y and y ≤ z imply x ≤ z . In a preorder we can have x � = y and x ≤ y ∧ y ≤ x .

  20. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x . antisymmetry x ≤ y and y ≤ x imply x = y . transitivity x ≤ y and y ≤ z imply x ≤ z . In a preorder we can have x � = y and x ≤ y ∧ y ≤ x . One also writes x � y to mean x �≤ y ∧ y �≤ x .

  21. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x . antisymmetry x ≤ y and y ≤ x imply x = y . transitivity x ≤ y and y ≤ z imply x ≤ z . In a preorder we can have x � = y and x ≤ y ∧ y ≤ x . One also writes x � y to mean x �≤ y ∧ y �≤ x . Chains and antichains If for all x , y ∈ B either x ≤ y or y ≤ x we have a chain . Also known as total order , where all elements are comparable.

  22. Order Relations Time, Logical Time and Non-strict order (or non strict partial order) Causality Carlos Baquero Let B be a set and ≤ a binary relation on B such that, for all Distributed Systems Group x , y , z ∈ B : Universidade do Minho reflexivity x ≤ x . antisymmetry x ≤ y and y ≤ x imply x = y . transitivity x ≤ y and y ≤ z imply x ≤ z . In a preorder we can have x � = y and x ≤ y ∧ y ≤ x . One also writes x � y to mean x �≤ y ∧ y �≤ x . Chains and antichains If for all x , y ∈ B either x ≤ y or y ≤ x we have a chain . Also known as total order , where all elements are comparable. We have an antichain if x ≤ y iff x = y .

  23. Order Relations Examples Time, Logical Time and Causality Carlos Baquero Distributed Sets Systems Group Universidade do A set X can be ordered by set inclusion, yielding � X , ⊆� . Minho

  24. Order Relations Examples Time, Logical Time and Causality Carlos Baquero Distributed Sets Systems Group Universidade do A set X can be ordered by set inclusion, yielding � X , ⊆� . Minho The powerset P ( X ), consisting of all subsets of X , is ordered by set inclusion.

  25. Order Relations Examples Time, Logical Time and Causality Carlos Baquero Distributed Sets Systems Group Universidade do A set X can be ordered by set inclusion, yielding � X , ⊆� . Minho The powerset P ( X ), consisting of all subsets of X , is ordered by set inclusion. Q: Does ⊆ form a total order on P ( X )?

  26. Order Relations Examples Time, Logical Time and Causality Carlos Baquero Distributed Sets Systems Group Universidade do A set X can be ordered by set inclusion, yielding � X , ⊆� . Minho The powerset P ( X ), consisting of all subsets of X , is ordered by set inclusion. Q: Does ⊆ form a total order on P ( X )? A: No, by counter example: { a , x , f } � { x , b } .

  27. Order Relations Examples Time, Logical Time and Causality Carlos Baquero Distributed Sets Systems Group Universidade do A set X can be ordered by set inclusion, yielding � X , ⊆� . Minho The powerset P ( X ), consisting of all subsets of X , is ordered by set inclusion. Q: Does ⊆ form a total order on P ( X )? A: No, by counter example: { a , x , f } � { x , b } . Binary sequences Exhibit a prefix ordering. Let 2 ∗ be the set of all finite binary strings, including �� . For x , y ∈ 2 ∗ we have x ≤ y iff x is a finite initial substring of v . E.g. 0100 < 010011, 010 � 100.

  28. Order Relations Examples Time, Logical Time and Causality Coordinatewise (pointwise) order Carlos Baquero Distributed Systems Group Let P 1 , . . . , P n be ordered sets. The cartesian product P 1 × · · · × P n Universidade do Minho can define a ordered set by pointwise order: ( x 1 , . . . , x n ) ≤ ( y 1 , . . . , y n ) ⇔ ( ∀ i ) x i ≤ y i in P i .

  29. Order Relations Examples Time, Logical Time and Causality Coordinatewise (pointwise) order Carlos Baquero Distributed Systems Group Let P 1 , . . . , P n be ordered sets. The cartesian product P 1 × · · · × P n Universidade do Minho can define a ordered set by pointwise order: ( x 1 , . . . , x n ) ≤ ( y 1 , . . . , y n ) ⇔ ( ∀ i ) x i ≤ y i in P i . Lexicographic order Let A , B be two ordered sets. The product A × B can have a lexicographic order defined by ( x 1 , x 2 ) ≤ ( y 1 , y 2 ) if x 1 < y 1 or ( x 1 = y 1 and x 2 ≤ y 2 ). By iteration a lexicographic order can be defined on any finite product.

  30. Order Relations Relations among orders Time, Logical Order isomorphism Time and Causality Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order Carlos Baquero Distributed isomorphism is a surjective (onto) total function h : S → T such Systems Group Universidade do that for all u , v ∈ S : Minho h ( u ) ≤ T h ( v ) iff u ≤ S v .

  31. Order Relations Relations among orders Time, Logical Order isomorphism Time and Causality Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order Carlos Baquero Distributed isomorphism is a surjective (onto) total function h : S → T such Systems Group Universidade do that for all u , v ∈ S : Minho h ( u ) ≤ T h ( v ) iff u ≤ S v . We say that � S , ≤ S � and � T , ≤ T � are equivalente and that one characterizes the other and vice-versa.

  32. Order Relations Relations among orders Time, Logical Order isomorphism Time and Causality Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order Carlos Baquero Distributed isomorphism is a surjective (onto) total function h : S → T such Systems Group Universidade do that for all u , v ∈ S : Minho h ( u ) ≤ T h ( v ) iff u ≤ S v . We say that � S , ≤ S � and � T , ≤ T � are equivalente and that one characterizes the other and vice-versa. A weaker form is Order preserving Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order preserving maping is a total function h : S → T such that for all u , v ∈ S : h ( u ) ≤ T h ( v ) if u ≤ S v .

  33. Order Relations Relations among orders Time, Logical Order isomorphism Time and Causality Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order Carlos Baquero Distributed isomorphism is a surjective (onto) total function h : S → T such Systems Group Universidade do that for all u , v ∈ S : Minho h ( u ) ≤ T h ( v ) iff u ≤ S v . We say that � S , ≤ S � and � T , ≤ T � are equivalente and that one characterizes the other and vice-versa. A weaker form is Order preserving Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order preserving maping is a total function h : S → T such that for all u , v ∈ S : h ( u ) ≤ T h ( v ) if u ≤ S v . We say that � T , ≤ T � is consistent with � S , ≤ S � .

  34. Order Relations Relations among orders Time, Logical Order isomorphism Time and Causality Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order Carlos Baquero Distributed isomorphism is a surjective (onto) total function h : S → T such Systems Group Universidade do that for all u , v ∈ S : Minho h ( u ) ≤ T h ( v ) iff u ≤ S v . We say that � S , ≤ S � and � T , ≤ T � are equivalente and that one characterizes the other and vice-versa. A weaker form is Order preserving Given two partially ordered sets � S , ≤ S � and � T , ≤ T � an order preserving maping is a total function h : S → T such that for all u , v ∈ S : h ( u ) ≤ T h ( v ) if u ≤ S v . We say that � T , ≤ T � is consistent with � S , ≤ S � . For instance, we will see that real time total ordering is consistent with causality.

  35. Logical Time and Causality Model Time, Logical Time and Causality Carlos Baquero Distributed An asynchronous system with a collection of totally ordered Systems Group Universidade do processes p 1 , . . . , p n . Minho

  36. Logical Time and Causality Model Time, Logical Time and Causality Carlos Baquero Distributed An asynchronous system with a collection of totally ordered Systems Group Universidade do processes p 1 , . . . , p n . Minho Reliable channels, not necessarely FIFO.

  37. Logical Time and Causality Model Time, Logical Time and Causality Carlos Baquero Distributed An asynchronous system with a collection of totally ordered Systems Group Universidade do processes p 1 , . . . , p n . Minho Reliable channels, not necessarely FIFO. Sequential processes, performing internal events, send events and corresponding receive events.

  38. Logical Time and Causality Model Time, Logical Time and Causality Carlos Baquero Distributed An asynchronous system with a collection of totally ordered Systems Group Universidade do processes p 1 , . . . , p n . Minho Reliable channels, not necessarely FIFO. Sequential processes, performing internal events, send events and corresponding receive events. In each process p i during a computation a local history is formed by the (potentially infinite) sequence of events: h i = � e 1 i , e 2 i , . . . � . As expected, time between events varies.

  39. Logical Time and Causality Model Time, Logical Time and Causality Carlos Baquero Distributed An asynchronous system with a collection of totally ordered Systems Group Universidade do processes p 1 , . . . , p n . Minho Reliable channels, not necessarely FIFO. Sequential processes, performing internal events, send events and corresponding receive events. In each process p i during a computation a local history is formed by the (potentially infinite) sequence of events: h i = � e 1 i , e 2 i , . . . � . As expected, time between events varies. h k i denotes an initial prefix of local history h i containing the first k events.

  40. Logical Time and Causality Model Time, Logical Time and Causality Carlos Baquero Distributed An asynchronous system with a collection of totally ordered Systems Group Universidade do processes p 1 , . . . , p n . Minho Reliable channels, not necessarely FIFO. Sequential processes, performing internal events, send events and corresponding receive events. In each process p i during a computation a local history is formed by the (potentially infinite) sequence of events: h i = � e 1 i , e 2 i , . . . � . As expected, time between events varies. h k i denotes an initial prefix of local history h i containing the first k events. The global history of the computation is the set H = h 1 ∪ . . . ∪ h n .

  41. Logical Time and Causality Causality Time, Logical Time and Causality Carlos Baquero We can now define a causality relation in distributed systems. Distributed Systems Group Universidade do Causality Minho Let � H , →� be a global history H ordered by the smalest transitive binary relation → such that:

  42. Logical Time and Causality Causality Time, Logical Time and Causality Carlos Baquero We can now define a causality relation in distributed systems. Distributed Systems Group Universidade do Causality Minho Let � H , →� be a global history H ordered by the smalest transitive binary relation → such that: e a i → e b i if e a i , e b i ∈ H and a < b .

  43. Logical Time and Causality Causality Time, Logical Time and Causality Carlos Baquero We can now define a causality relation in distributed systems. Distributed Systems Group Universidade do Causality Minho Let � H , →� be a global history H ordered by the smalest transitive binary relation → such that: e a i → e b i if e a i , e b i ∈ H and a < b . e s i → e r j if e s i is a send event and e r j the corresponding receive event.

  44. Logical Time and Causality Causality Time, Logical Time and Causality Carlos Baquero We can now define a causality relation in distributed systems. Distributed Systems Group Universidade do Causality Minho Let � H , →� be a global history H ordered by the smalest transitive binary relation → such that: e a i → e b i if e a i , e b i ∈ H and a < b . e s i → e r j if e s i is a send event and e r j the corresponding receive event. If a → b then a may have influenced b . In general we have potential causality.

  45. Logical Time and Causality Causality Time, Logical Time and Causality Carlos Baquero We can now define a causality relation in distributed systems. Distributed Systems Group Universidade do Causality Minho Let � H , →� be a global history H ordered by the smalest transitive binary relation → such that: e a i → e b i if e a i , e b i ∈ H and a < b . e s i → e r j if e s i is a send event and e r j the corresponding receive event. If a → b then a may have influenced b . In general we have potential causality. On non trivial runs � H , →� forms a partial order, and some events will be parallel a � b when neither a → b nor b → a .

  46. � � � � � Logical Time and Causality Preserving causal order Time, Logical Time and Causality If we had a global time clock function T : H → R that would assign a Carlos Baquero Distributed real to each event. We would observe that the total order �T ( H ) , < � Systems Group Universidade do is consistent with � H , →� . Real time preserves the causal order. Minho Run e 1 e 2 p a a a • • � � � � � � e 1 e 2 � p b b b • • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � • � � • p c • e 1 e 2 e 3 c c c

  47. � � � � � Logical Time and Causality Preserving causal order Time, Logical Time and Causality If we had a global time clock function T : H → R that would assign a Carlos Baquero real to each event. We would observe that the total order �T ( H ) , < � Distributed Systems Group is consistent with � H , →� . Real time preserves the causal order. Universidade do Minho Run with real time tags 10 s 17 s p a • • � � � � � � � 12 s 17 . 1 s p b • • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � • � � • p c • 11 . 8 s 23 s 54 . 2 s

  48. � � � � � Logical Time and Causality Preserving causal order Time, Logical Time and Causality If we had a global time clock function T : H → R that would assign a Carlos Baquero real to each event. We would observe that the total order �T ( H ) , < � Distributed Systems Group is consistent with � H , →� . Real time preserves the causal order. Universidade do Minho Run with real time tags 10 s 17 s p a • • � � � � � � � 12 s 17 . 1 s p b • • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � • � � • p c • 11 . 8 s 23 s 54 . 2 s Notice that while 11 . 8 s < 12 s the corresponding events are parallel e 1 c � e 1 b in the causal order.

  49. Logical Time and Causality Clock condition Time, Logical Time and Causality Carlos Baquero Distributed Being consistent with causality if often captured by a clock condition . Systems Group Universidade do Minho

  50. Logical Time and Causality Clock condition Time, Logical Time and Causality Carlos Baquero Distributed Being consistent with causality if often captured by a clock condition . Systems Group Universidade do Minho Clock Condition (Lamport 78) A clock function C : H → T and a ordered set � T , < � satisfies clock condition if: For any events a , b ∈ H : if a → b then C ( a ) < C ( b ).

  51. Logical Time and Causality Clock condition Time, Logical Time and Causality Carlos Baquero Distributed Being consistent with causality if often captured by a clock condition . Systems Group Universidade do Minho Clock Condition (Lamport 78) A clock function C : H → T and a ordered set � T , < � satisfies clock condition if: For any events a , b ∈ H : if a → b then C ( a ) < C ( b ). Notice that the timestamping function is necessarely one-to-one (injective) in order to satisfy the clock conditions and preserve the causal order.

  52. Logical Time and Causality Clock condition Time, Logical Time and Causality Carlos Baquero Distributed Being consistent with causality if often captured by a clock condition . Systems Group Universidade do Minho Clock Condition (Lamport 78) A clock function C : H → T and a ordered set � T , < � satisfies clock condition if: For any events a , b ∈ H : if a → b then C ( a ) < C ( b ). Notice that the timestamping function is necessarely one-to-one (injective) in order to satisfy the clock conditions and preserve the causal order. Appart from real time there are other timestamping functions that satisfy this clock condition.

  53. � � � � � � � � � � Logical Time and Causality Lamport Time Time, Logical Time and Run Causality e 1 e 2 e 3 e 4 Carlos Baquero � • � • p a • a a a a • Distributed � Systems Group � Universidade do � � Minho e 1 e 2 e 3 e 4 � � • � • p b • b b � b b • � � � � � � � � � � � � � � � � � � � � � � � � � � e 1 � � � � � � • � • � • p c • c � e 2 e 3 e 4 c c c Run with timestamping consistent with causality p a • 1 � • 2 • 3 � • 4 � � � � � p b • 1 � • 2 � • 3 • 4 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � p c • 1 � • 3 � • 5 � • 6 �

  54. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho

  55. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1.

  56. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1. On each internal event in p i do L i := L i + 1.

  57. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1. On each internal event in p i do L i := L i + 1. On a send event at p i do L i := L i + 1 and attach L i to the message.

  58. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1. On each internal event in p i do L i := L i + 1. On a send event at p i do L i := L i + 1 and attach L i to the message. On a receive event at p i with L x attached do L i := max ( L i , L x ) + 1.

  59. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1. On each internal event in p i do L i := L i + 1. On a send event at p i do L i := L i + 1 and attach L i to the message. On a receive event at p i with L x attached do L i := max ( L i , L x ) + 1. The value registred at L i right after each event e k i is the one defining L ( e k i ).

  60. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1. On each internal event in p i do L i := L i + 1. On a send event at p i do L i := L i + 1 and attach L i to the message. On a receive event at p i with L x attached do L i := max ( L i , L x ) + 1. The value registred at L i right after each event e k i is the one defining L ( e k i ). A positive integer could be used in place of 1.

  61. Logical Time and Causality Lamport Time Time, Logical Time and Causality Lamport Time L Carlos Baquero We can assign integer valued timestamps by a function L : H → N Distributed Systems Group constructed as follows, with local knowledge: Universidade do Minho Initially all processes p i set L i to 1. On each internal event in p i do L i := L i + 1. On a send event at p i do L i := L i + 1 and attach L i to the message. On a receive event at p i with L x attached do L i := max ( L i , L x ) + 1. The value registred at L i right after each event e k i is the one defining L ( e k i ). A positive integer could be used in place of 1. Notice that while Lamport Time L and Real Time L are both consistent with causality � H , →� , the mutual relation between L and T is not tipically consistent in non trivial runs.

  62. Logical Time and Causality Lamport Time Time, Logical We can further refine Lamport Time in order to obtain an injective Time and function L t that assigns a consistent total order to all events in H . It Causality Carlos Baquero suffices to consider the lexicographic order on the pair formed by the Distributed Systems Group Lamport Time and the process number. Universidade do Minho

  63. � � � � � Logical Time and Causality Lamport Time Time, Logical We can further refine Lamport Time in order to obtain an injective Time and function L t that assigns a consistent total order to all events in H . It Causality Carlos Baquero suffices to consider the lexicographic order on the pair formed by the Distributed Systems Group Lamport Time and the process number. Universidade do Minho Run with total order L t Here, since processes have letters we assume the alphabetic order. 1 , a 2 , a 3 , a 4 , a � • � • p a • • � � � � � 1 , b 2 , b 3 , b 4 , b � • � • p b • � • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 1 , c � � • � • � � • � p c • 3 , c 5 , c 6 , c (1 , a )(1 , b )(1 , c )(2 , a )(2 , b )(3 , a )(3 , b )(3 , c )(4 , a )(4 , b )(5 , c )(6 , c )

  64. � � � � � Logical Time and Causality Lamport Time Time, Logical We can further refine Lamport Time in order to obtain an injective Time and function L t that assigns a consistent total order to all events in H . It Causality Carlos Baquero suffices to consider the lexicographic order on the pair formed by the Distributed Systems Group Lamport Time and the process number. Universidade do Minho Run with total order L t Here, since processes have letters we assume the alphabetic order. 1 , a 2 , a 3 , a 4 , a � • � • p a • • � � � � � 1 , b 2 , b 3 , b 4 , b � • � • p b • � • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � 1 , c � � • � • � � • � p c • 3 , c 5 , c 6 , c (1 , a )(1 , b )(1 , c )(2 , a )(2 , b )(3 , a )(3 , b )(3 , c )(4 , a )(4 , b )(5 , c )(6 , c ) This total order is usefull in many distributed algorithms (e.g. Lamport mutual exclusion algorithm), but it orders more events than causality. For other algorithms we need to capture causality precisely.

  65. Logical Time and Causality Characterizing causality Time, Logical A simple timestamping mechanism that can characterize causality is Time and Causality to locally register the causal history C : H → P ( H ). This is done by Carlos Baquero collecting in a set each distinct event identifier. Distributed Systems Group Universidade do Minho

  66. � � � � Logical Time and Causality Characterizing causality Time, Logical A simple timestamping mechanism that can characterize causality is Time and Causality to locally register the causal history C : H → P ( H ). This is done by Carlos Baquero collecting in a set each distinct event identifier. Notice that each Distributed Systems Group process has a unique number and can maintain a sequential counter Universidade do Minho for its events. Run tagged with causal histories { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • � { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � • � p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 }

  67. � � � � Logical Time and Causality Characterizing causality Time, Logical A simple timestamping mechanism that can characterize causality is Time and Causality to locally register the causal history C : H → P ( H ). This is done by Carlos Baquero collecting in a set each distinct event identifier. Notice that each Distributed Systems Group process has a unique number and can maintain a sequential counter Universidade do Minho for its events. Run tagged with causal histories { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • � { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � • � p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 } e 2 a → e 2 c ⇔ C ( e 2 a ) ⊆ C ( e 2 c ) ⇔ { a 1 , a 2 } ⊆ { c 1 , a 1 , a 2 , c 2 }

  68. � � � � Logical Time and Causality Characterizing causality Time, Logical A simple timestamping mechanism that can characterize causality is Time and Causality to locally register the causal history C : H → P ( H ). This is done by Carlos Baquero collecting in a set each distinct event identifier. Notice that each Distributed Systems Group process has a unique number and can maintain a sequential counter Universidade do Minho for its events. Run tagged with causal histories { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • � { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � • � p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 } e 2 a → e 2 c ⇔ C ( e 2 a ) ⊆ C ( e 2 c ) ⇔ { a 1 , a 2 } ⊆ { c 1 , a 1 , a 2 , c 2 } e 3 a �→ e 3 b ⇔ C ( e 3 a ) �⊆ C ( e 3 b ) ⇔ { a 1 , a 2 , a 3 } �⊆ { b 1 , b 2 , b 3 }

  69. � � � � Logical Time and Causality Characterizing causality Time, Logical A simple timestamping mechanism that can characterize causality is Time and Causality to locally register the causal history C : H → P ( H ). This is done by Carlos Baquero collecting in a set each distinct event identifier. Notice that each Distributed Systems Group process has a unique number and can maintain a sequential counter Universidade do Minho for its events. Run tagged with causal histories { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • � { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � • � p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 } e 2 a → e 2 c ⇔ C ( e 2 a ) ⊆ C ( e 2 c ) ⇔ { a 1 , a 2 } ⊆ { c 1 , a 1 , a 2 , c 2 } e 3 a �→ e 3 b ⇔ C ( e 3 a ) �⊆ C ( e 3 b ) ⇔ { a 1 , a 2 , a 3 } �⊆ { b 1 , b 2 , b 3 } e 3 b �→ e 3 a ⇔ C ( e 3 b ) �⊆ C ( e 3 a ) ⇔ { b 1 , b 2 , b 3 } �⊆ { a 1 , a 2 , a 3 }

  70. � � � � Logical Time and Causality Characterizing causality Time, Logical Time and Causality Run tagged with causal histories Carlos Baquero Distributed Systems Group { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • Universidade do � Minho { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � � • p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 } The problem of causal histories is their space complexity that grows linearly, O ( E ), with the number of events E.

  71. � � � � Logical Time and Causality Characterizing causality Time, Logical Time and Causality Run tagged with causal histories Carlos Baquero Distributed Systems Group { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • Universidade do � Minho { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � � • p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 } The problem of causal histories is their space complexity that grows linearly, O ( E ), with the number of events E. This can be solved by noticing that for all k and i and a causal i , . . . , e k − 1 history C x : if e k i ∈ C x then { e 1 } ⊆ C x . i

  72. � � � � Logical Time and Causality Characterizing causality Time, Logical Time and Causality Run tagged with causal histories Carlos Baquero Distributed Systems Group { a 1 } { a 1 , a 2 } { a 1 , a 2 , a 3 } � • � • p a • • Universidade do � Minho { a 1 , a 2 , a 3 , a 4 } � � � � { b 1 } { b 1 , b 2 } { b 1 , b 2 , b 3 } � � • � � • p b • • � � � � � � � � � { b 1 , b 2 , b 3 , b 4 } � � � � � � � � � � � � � � � � � � � { c 1 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 , c 4 } � � � � • � • � � • p c • { c 1 , a 1 , a 2 , c 2 } { c 1 , a 1 , a 2 , c 2 , b 1 , b 2 , b 3 , b 4 , c 3 } The problem of causal histories is their space complexity that grows linearly, O ( E ), with the number of events E. This can be solved by noticing that for all k and i and a causal i , . . . , e k − 1 history C x : if e k i ∈ C x then { e 1 } ⊆ C x . i Consequently one only needs to register the index of the last event from each process.

  73. Logical Time and Causality Vector Clocks Time, Logical Vector clocks are compressed causal histories. V : H → N n where n is Time and Causality the number of processes. They can be represented in a vector or as Carlos Baquero Distributed mappings from process names to integers. Systems Group Universidade do Minho

  74. � � � � � Logical Time and Causality Vector Clocks Time, Logical Vector clocks are compressed causal histories. V : H → N n where n is Time and Causality the number of processes. They can be represented in a vector or as Carlos Baquero Distributed mappings from process names to integers. Systems Group Universidade do Minho Run tagged with vector clocks { a �→ 1 } { a �→ 2 } { a �→ 3 } � • � • p a • • � { a �→ 4 } � � � � { b �→ 1 } { b �→ 2 } { b �→ 3 } � • � � • p b • • � � � � � � � � � { b �→ 4 } � � � � � � � � � � � � � � � � � � � { c �→ 1 } � { a �→ 2 , b �→ 4 , c �→ 4 } � � � • � • � � • p c • { a �→ 2 , c �→ 2 } { a �→ 2 , b �→ 4 , c �→ 3 }

  75. � � � � � Logical Time and Causality Vector Clocks Time, Logical Vector clocks are compressed causal histories. V : H → N n where n is Time and Causality the number of processes. They can be represented in a vector or as Carlos Baquero Distributed mappings from process names to integers. Systems Group Universidade do Minho Run tagged with vector clocks { a �→ 1 } { a �→ 2 } { a �→ 3 } � • � • p a • • � { a �→ 4 } � � � � { b �→ 1 } { b �→ 2 } { b �→ 3 } � • � � • p b • • � � � � � � � � � { b �→ 4 } � � � � � � � � � � � � � � � � � � � { c �→ 1 } { a �→ 2 , b �→ 4 , c �→ 4 } � � � � • � • � � • p c • { a �→ 2 , c �→ 2 } { a �→ 2 , b �→ 4 , c �→ 3 } Vector clocks are used in many distributed algorithms. E.g. causal delivery of messages, an extension of FIFO delivery. They can be used as long as processes have unique ids. A total order on ids is only a convenience (trivially obtained from unique ids).

  76. � � � � � Logical Time and Causality Vector Clocks Time, Logical Time and Causality Carlos Baquero Run tagged with vector clocks Distributed Systems Group Universidade do [1 , 0 , 0] [2 , 0 , 0] [3 , 0 , 0] [4 , 0 , 0] � • � • p a • • Minho � � � � � [0 , 1 , 0] [0 , 2 , 0] [0 , 3 , 0] [0 , 4 , 0] � • � • � p b • • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � [0 , 0 , 1] [2 , 4 , 4] � � � • � • � � • p c • [2 , 0 , 2] [2 , 4 , 3] The cordinatewise (pointwise) order on version vectors characterizes causality. They define identical partial orders. [2 , 0 , 0] < [2 , 0 , 2] but [0 , 4 , 0] � [2 , 0 , 2]

  77. � � � � � Logical Time and Causality Vector Clocks Time, Logical Time and Causality Carlos Baquero Run tagged with vector clocks Distributed Systems Group Universidade do [1 , 0 , 0] [2 , 0 , 0] [3 , 0 , 0] [4 , 0 , 0] � • � • p a • • Minho � � � � � [0 , 1 , 0] [0 , 2 , 0] [0 , 3 , 0] [0 , 4 , 0] � • � • � p b • • � � � � � � � � � � � � � � � � � � � � � � � � � � � � � [0 , 0 , 1] [2 , 4 , 4] � � � • � • � � • p c • [2 , 0 , 2] [2 , 4 , 3] The cordinatewise (pointwise) order on version vectors characterizes causality. They define identical partial orders. [2 , 0 , 0] < [2 , 0 , 2] but [0 , 4 , 0] � [2 , 0 , 2] Complexity is O ( N log E ) and V is known to be the most concise timestamping mechanism for process causality tracking.

  78. Process Causality vs Data Causality Time, Logical Time and Causality Carlos Baquero Distributed Systems Group Causality is formed as relevant events are colected in a run. Universidade do Minho

  79. Process Causality vs Data Causality Time, Logical Time and Causality Carlos Baquero Distributed Systems Group Causality is formed as relevant events are colected in a run. Universidade do Minho In process causality the relevante events are internal , send and receive events.

Recommend


More recommend