Same problem, different approach Monitor process does not query explicitly Instead, it passively collects information and uses it to build an observation. (reactive architectures, Harel and Pnueli [1985]) An observation is an ordering of event of the distributed computation based on the order in which the receiver is notified of the events. 75
Observations: a few observations An observation puts no constraint on the order in which the monitor receives notifications p 0 e 1 1 p 1 76
Observations: a few observations An observation puts no constraint on the order in which the monitor receives notifications p 0 e 2 e 1 1 1 p 1 77
Observations: a few observations An observation puts no constraint on the order in which the monitor receives notifications p 0 e 2 e 1 1 1 p 1 78
Observations: a few observations An observation puts no constraint on the order in which the monitor receives notifications p 0 e 2 e 1 1 1 p 1 To obtain a run, messages must be delivered to the monitor in FIFO order 79
Observations: a few observations An observation puts no constraint on the order in which the monitor receives notifications p 0 e 2 e 1 1 1 p 1 To obtain a run, messages must be delivered to the monitor in FIFO order What about consistent runs? 80
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) 81
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) Causal delivery generalizes FIFO: send i ( m ) → send k ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) 82
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) Causal delivery generalizes FIFO: send i ( m ) → send k ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) p 1 send event m receive event deliver event p 2 p 3 83
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) Causal delivery generalizes FIFO: send i ( m ) → send k ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) p 1 send event m receive event deliver event p 2 p 3 84
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) Causal delivery generalizes FIFO: send i ( m ) → send k ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) p 1 send event m receive event deliver event p 2 m � p 3 85
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) Causal delivery generalizes FIFO: send i ( m ) → send k ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) p 1 send event m receive event deliver event p 2 m � p 3 1 86
Causal delivery FIFO delivery guarantees: send i ( m ) → send i ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) Causal delivery generalizes FIFO: send i ( m ) → send k ( m � ) ⇒ deliver j ( m ) → deliver j ( m � ) p 1 send event m receive event deliver event p 2 m � p 3 1 2 87
Causal Delivery in Synchronous Systems We use the upper bound on ∆ message delivery time 88
Causal Delivery in Synchronous Systems We use the upper bound on ∆ message delivery time DR1: At time , delivers all messages t p 0 it received with timestamp up to t − ∆ in increasing timestamp order 89
Causal Delivery with Lamport Clocks � DR1.1: � Deliver all received messages in � increasing (logical clock) timestamp order. 90
Causal Delivery with Lamport Clocks � DR1.1: � Deliver all received messages in � increasing (logical clock) timestamp order. 1 p 0 91
Causal Delivery with Lamport Clocks � DR1.1: � Deliver all received messages in � increasing (logical clock) timestamp order. 1 4 Should deliver? p 0 p 0 92
Causal Delivery with Lamport Clocks � DR1.1: � Deliver all received messages in � increasing (logical clock) timestamp order. 1 4 Should deliver? p 0 p 0 Problem: Lamport Clocks don’ t provide gap detection Given two events and and their clock e � e values and — where LC ( e � ) LC ( e ) LC ( e ) < LC ( e � ) determine whether some event exists s.t. e �� LC ( e ) < LC ( e �� ) < LC ( e � ) 93
Stability DR2: � Deliver all received stable messages in increasing (logical clock) timestamp order. A message received by is stable at if p p p m will never receive a future message s.t. m � TS ( m � ) < TS ( m ) 94
Implementing Stability Real-time clocks wait for time units ∆ 95
Implementing Stability Real-time clocks wait for time units ∆ Lamport clocks wait on each channel for s.t. TS ( m ) > LC ( e ) m Design better clocks! 96
Clocks and STRONG Clocks Lamport clocks implement the clock condition: e → e � ⇒ LC ( e ) < LC ( e � ) We want new clocks that implement the strong clock condition: e → e � ≡ SC ( e ) < SC ( e � ) 97
Causal Histories The causal history of an event in is the set ( H, → ) e θ ( e ) = { e � ∈ H | e � → e } ∪ { e } 98
Causal Histories The causal history of an event in is the set ( H, → ) e θ ( e ) = { e � ∈ H | e � → e } ∪ { e } e 1 e 2 e 3 e 4 e 5 1 1 1 1 1 p 1 p 2 e 1 e 2 e 3 2 2 2 p 3 e 1 e 2 e 3 e 4 3 3 3 3 99
Causal Histories The causal history of an event in is the set ( H, → ) e θ ( e ) = { e � ∈ H | e � → e } ∪ { e } e 1 e 2 e 3 e 4 e 5 1 1 1 1 1 p 1 p 2 e 1 e 2 e 3 2 2 2 p 3 e 1 e 2 e 3 e 4 3 3 3 3 e → e � ≡ θ ( e ) ⊂ θ ( e � ) 100
How to build θ ( e ) Each process : p i initializes θ := ∅ θ : if is an internal or send event, then e k i θ ( e k i ):= { e k i } ∪ θ ( e k − 1 ) i if is a receive event for message , then e k m i i } ∪ θ ( e k − 1 θ ( e k i ):= { e k ) ∪ θ ( send ( m )) i 101
Pruning causal histories Prune segments of history that are known to all processes (Peterson, Bucholz and Schlichting) Use a more clever way to encode θ ( e ) 102
Vector Clocks Consider , the projection of on θ i ( e ) θ ( e ) p i h i θ i ( e ) = h k i is a prefix of : – it can be θ i ( e ) i encoded using k i can be θ ( e ) = θ 1 ( e ) ∪ θ 2 ( e ) ∪ . . . ∪ θ n ( e ) encoded using k 1 , k 2 , . . . , k n Represent using an -vector such that θ V C n V C ( e )[ i ] = k ⇔ θ i ( e ) = h k i i 103
Update rules e i p i V C ( e i )[ i ] := V C [ i ] + 1 Message is m timestamped with m TS ( m ) = V C ( send ( m )) e i p i V C ( e i ) := max ( V C, TS ( m )) V C ( e i )[ i ] := V C [ i ] + 1 104
Example [1,0,0] [2,1,0] [5,1,2] [3,1,2] [4,1,2] p 1 [1,2,3] p 2 [0,1,0] [4,3,3] p 3 [1,0,1] [1,0,2] [1,0,3] [5,1,4] 105
Operational interpretation [1,0,0] [2,1,0] [5,1,2] [3,1,2] [4,1,2] p 1 [1,2,3] p 2 [0,1,0] [4,3,3] p 3 [1,0,1] [1,0,2] [1,0,3] [5,1,4] = V C ( e i )[ i ] = V C ( e i )[ j ] 106
Operational interpretation [1,0,0] [2,1,0] [5,1,2] [3,1,2] [4,1,2] p 1 [1,2,3] p 2 [0,1,0] [4,3,3] p 3 [1,0,1] [1,0,2] [1,0,3] [5,1,4] = no. of events executed by up to and including V C ( e i )[ i ] p i e i = V C ( e i )[ j ] 107
Operational interpretation [1,0,0] [2,1,0] [5,1,2] [3,1,2] [4,1,2] p 1 [1,2,3] p 2 [0,1,0] [4,3,3] p 3 [1,0,1] [1,0,2] [1,0,3] [5,1,4] = no. of events executed by up to and including V C ( e i )[ i ] p i e i = no. of events executed by that happen before of V C ( e i )[ j ] p j p i e i 108
VC properties: event ordering Given two vectors and , less than is defined as: V � V V < V � ≡ ( V � = V � ) ∧ ( ∀ k : 1 ≤ k ≤ n : V [ k ] ≤ V � [ k ]) Strong Clock Condition: e → e � ≡ V C ( e ) ≤ V C ( e � ) Simple Strong Clock Condition: Given of and of , where i � = j p i e j p j e i e i → e j ≡ V C ( e i )[ i ] ≤ V C ( e j )[ i ] Concurrency Given of and of , where i � = j p i e j p j e i e i � e j ≡ ( V C ( e i )[ i ] > V C ( e j )[ i ]) ∧ ( V C ( e j )[ j ] > V C ( e i )[ j ]) 109
VC properties: consistency Pairwise inconsistency Events of and of are pairwise ( i � = j ) e i p i e j p j inconsistent (i.e. can’t be on the frontier of the same consistent cut) if and only if ( VC ( e i )[ i ] < VC ( e j )[ i ]) ∨ ( VC ( e j )[ j ] < VC ( e i )[ j ]) Consistent Cut A cut defined by is consistent if and ( c 1 , . . . , c n ) only if i )[ i ] ≥ VC ( e c j ∀ i, j : 1 ≤ i ≤ n, 1 ≤ j ≤ n : ( VC ( e c i j )[ i ]) 110
VC properties: weak gap detection Weak gap detection Given of and of , if VC ( e i )[ k ] < VC ( e j )[ k ] p i e i e j p j for some , then there exists s.t k � = j e k ¬ ( e k → e i ) ∧ ( e k → e j ) [2,0,1] p i [2,2,2] p j p k [0,0,2] 111
VC properties: weak gap detection Weak gap detection Given of and of , if VC ( e i )[ k ] < VC ( e j )[ k ] p i e i e j p j for some , then there exists s.t k � = j e k ¬ ( e k → e i ) ∧ ( e k → e j ) [1,0,1] [2,0,1] p i [2,2,2] p j [2,1,1] p k [0,0,1] [0,0,2] 112
Recommend
More recommend