conjunctive predicates 1 goals of the lecture conjunctive
play

Conjunctive Predicates 1 Goals of the lecture: Conjunctive - PowerPoint PPT Presentation

Conjunctive Predicates 1 Goals of the lecture: Conjunctive Predicates Direct dep endency algo rithm T ok en based decentralized algo rithm Channel Predicates Reference: Chapter 5. Vija c y K. Ga rg


  1. Conjunctive Predicates 1 Goals of the lecture: Conjunctive Predicates � Direct dep endency algo rithm � T ok en based decentralized algo rithm � Channel Predicates Reference: Chapter 5. � Vija c y K. Ga rg Distributed Systems Sp ring 96

  2. Conjunctive Predicates 2 Algo rithm fo r application p ro cess P i � Assume fully connected net w o rk � Mattern's vecto r clo ck � Notation: � ( i; k ) : the k th state on p ro cess P (o r simply k ) i � Vija c y K. Ga rg Distributed Systems Sp ring 96

  3. Conjunctive Predicates 3 Monito r Pro cesses fo r W CP � Monito r p ro cesses resp onsible fo r sea rching fo r a W CP cut. � The tok en sto res a candidate cut. � The tok en also sto res info rmation to determine whether the candidate cut is consistent. � Vija c y K. Ga rg Distributed Systems Sp ring 96

  4. Conjunctive Predicates 4 Info rmal Description � A tok en is sent to a p ro cess P only when the current cut i is not consistent. Sp eci�cally , when current state from P i happ ened b efo re some other state in the candidate cut. � Once the monito r p ro cess fo r P has eliminated the current i state, � receive a new state from the applicatio n p ro cess � check fo r consistency conditions again. � This p ro cess is rep eated until � all states a re eliminate d from some p ro cess P o r i � the W CP is detected. � Vija c y K. Ga rg Distributed Systems Sp ring 96

  5. Conjunctive Predicates 5 T ok en � A monito r p ro cess is active only if it has the tok en. � tok en consists of t w o vecto rs G and col or . � G is a global state vecto r rep resents the candidate global cut � G [ i ] = k indicates that state ( i; k ) is pa rt of the current cut. � W e maintain the inva riant that G [ i ] = k implies that any global cut C with ( i; s ) 2 C and s < k cannot satisfy the W CP. � c olor , indicates which states have b een eliminate d. � If col or [ i ] = r ed then state ( i; G [ i ]) has b een eliminated and can never satisfy the global p redicate. � If col or [ i ] = g r een , then there is no state in G such that ( i; G [ i ]) happ ened b efo re that state. � Vija c y K. Ga rg Distributed Systems Sp ring 96

  6. Conjunctive Predicates 6 Monito r Pro cess Algo rithm v ar candidate:arra y[1..n] of in teger; on receiving the tok en (G,color) while (color[i] = red) do receiv e candidate from application pro cess P i if (candidate.v clo c k[i] > G[i]) then G[i] := candidate.v clo c k[i]; color[i]:=green; endwhile for j 6 = i : if (candidate.v clo c k[j] > G[j]) then G[j] := candidate.v clo c k[j]; color[j]:=red; endif endfor if ( 9 j: color[j] = red) then send tok en to P j else detect := true; Figure 1: Monitor Pro cess Algorithm � Vija c y K. Ga rg Distributed Systems Sp ring 96

  7. Conjunctive Predicates 7 Co rrectness of W CP Detection Algo rithm The algo rithm co rrectly detects the �rst cut that satis�es a W CP. Lemma 1 F or any i , 1. G [ i ] 6 = 0 ^ col or [ i ] = r ed ) 9 j : j 6 = i : ( i; G [ i ]) ! ( j; G [ j ]) ; 2. col or [ i ] = g r een ) 8 k : ( i; G [ i ]) 6! ( k ; G [ k ]) ; 3. ( col or [ i ] = g r een ) ^ ( col or [ j ] = g r een ) ) ( i; G [ i ]) k ( j; G [ j ]) . 4. If ( col or [ i ] = r ed ) , then ther e is no glob al cut satisfying the WCP which includes ( i; G [ i ]) . � Vija c y K. Ga rg Distributed Systems Sp ring 96

  8. Conjunctive Predicates 8 Analysis of Single-T ok en W CP Algo rithm � time complexit y: the total computation time fo r all p ro cesses 2 is O ( n m ) � Every time a state is eliminate d, O ( n ) w o rk is p erfo rmed � There a re at most mn states. � Message complexit y: the total numb er of messages O ( mn ) . � the tok en is sent at most mn times. � each monito r receives at most m messages from its applicati on p ro- cess. 2 � Communication bit complexit y: O ( n m ) . � size of b oth the tok en and the candidate messages is O ( n ) . � space complexit y: O ( mn ) space is required b y the algo rithm fo r every p ro cess. � the bu�er fo r holding messages � Vija c y K. Ga rg Distributed Systems Sp ring 96

  9. Conjunctive Predicates 9 Channel Predicates � A channel p redicate: any b o olean function of the accumula- tion of send and receive events on that channel. � Only uni-directional channels s; t : states at di�erent p ro cesses. s:send [ t:p ] : string of all messages sent at o r b efo re state s from s:p to t:p . t:r eceiv ed [ s:p ] : string of all messages received at o r b efo re state t from t:p to s:p . The channel p redicate can then b e written as: c ( s:send [ t:p ] ; t:r eceiv ed [ s:p ]) j o r in sho rt notation as: c ( S; R ) � c ( s:send [ t:p ] ; t:r eceiv e [ s:p ]) j j � Requirements fo r monotonicit y � Vija c y K. Ga rg Distributed Systems Sp ring 96

  10. Conjunctive Predicates 10 Examples Example 1 Empty channels: len(S)=len(R): This sa ys that if a channel p redicate is false, then it cannot b e made true b y sending mo re messages without receiving mo re messages. Example 2 Nonempty channels: ( ns > nr ) : ( ns � nr > nk ) /* at least k messages in the channel */ � Vija c y K. Ga rg Distributed Systems Sp ring 96

  11. Conjunctive Predicates 11 GCP-cuts C : global cuts that satisfy a GCP with monotone channel p red- icates � C � D i� 8 i : C [ i ] � D [ i ] . W e sho w that the concept of �rst cut that satis�es a GCP is w ell-de�ned. Theorem 2 If C ; D 2 C , then their gr e atest lower b ound is also in C . Pr o of: � Vija c y K. Ga rg Distributed Systems Sp ring 96

  12. Conjunctive Predicates 12 Example: no �rst cut in general p redicate: There a re an o dd numb er of messages in the channel. true only at p oints C [1] and D [1] fo r P , and C [2] and D [2] fo r 1 P . 2 the GCP is true in the cut C and D but not in their greatest lo w er b ound. Figure 2: consisten t cuts satisfying a GCP is not a lattice. C[1] D[1] � Vija c y K. Ga rg Distributed Systems Sp ring 96 C[2] D[2]

  13. Conjunctive Predicates 13 Non-check er p ro cess algo rithm initial l y 8 j : j 6 = i :lcmvecto r[ j ] = 0; lcmvecto r[ i ] = 1; �rs�ag = true;incsend = increcv = ; ; F or sending m do send (lcmvecto r, m); lcmvecto r[ i ]++ ; �rst�ag:=true; incsend:= incsend � m; Up on receive (msg lcmvecto r, m) do lcmvecto r:=max (lcm vecto r, msg lcmvecto r); �rst�ag:=true; increcv:= increcv � m; Up on (lo cal p red = true) ^ �rst�ag do send (lcmvecto r,incsend,increcv) to check er ; �rst�ag := false; incsend:=increcv:= ; ; � Vija c y K. Ga rg Distributed Systems Sp ring 96

  14. Conjunctive Predicates 14 Data Structures of the Check er Pro cess - p er-p ro cess data � cut:a rra y[1..n] of struct v:vecto r of integer; colo r:red, green � The colo r of a state is either red o r green. green: the current state is concurrent with the current states from all other green p ro cesses. red: the current state cannot b e pa rt of a GCP cut � A FIF O queue of successive lo cal snapshots from this p ro cess. � q:a rra y[1..n] of queues of struct � v:vecto r of integer; � incsend:a rra y[1..n] of sequences of messages; � increcv:a rra y[1..n] of sets of messages; � Vija c y K. Ga rg Distributed Systems Sp ring 96

  15. Conjunctive Predicates 15 P er-Channel Data three data structures fo r each channel: 1. A p ending-send list: messages sent but not y et received S[i,j]: sequence of messageinfo; 2. A p ending-receive list: o rdered list of message sequence num- b ers. R[i,j]: sets of messageinfo ; 3. A CP-state �ag. V alue of channel p redicates � T (true) only if the channel p redicate fo r that channel is true fo r the current cut � F (false) only if the channel p redicate fo r that channel is false fo r the current cut. The CP-state �ag can tak e the value X (unk o wn) at any time. cp[i,j]:X,F,T � Vija c y K. Ga rg Distributed Systems Sp ring 96

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend