intro duction 1 goals of the lecture w eak conjunctive
play

Intro duction 1 Goals of the lecture: W eak Conjunctive - PowerPoint PPT Presentation

Intro duction 1 Goals of the lecture: W eak Conjunctive Predicates Logic fo r global p redicates W eak conjunctive algo rithm References: Garg and W aldec k er 94 Vija c y K. Ga rg Distributed


  1. Intro duction 1 Goals of the lecture: W eak Conjunctive Predicates � Logic fo r global p redicates � W eak conjunctive algo rithm References: Garg and W aldec k er 94 � Vija c y K. Ga rg Distributed Systems F all 94

  2. Intro duction 2 Logic fo r Global Predicates � Three syntactic catego ries in the logic - b o ol , lin and form . � Syntax: fo rm ::= A: lin j E: lin lin ::= 3 lin j lin ^ lin j : lin j b o ol b o ol ::= a p redicate over a global state � bool : b o olean exp ression de�ned on a single global state of the system. � Example: if the global state has ( x = 3 ; y = 6 ), then the bool ( x � y ) is true. � l in is a temp o ral fo rmula de�ned over a global sequence. � bool is true in g if it is true in the last state of g . � 3 lin : there exists a p re�x of g such that lin is true fo r the p re�x. � 2 and _ : duals of 3 and ^ . � A form is de�ned fo r a run and it is simply a lin quali�ed with universal ( A :) o r existential ( E :) quanti�er. � Vija c y K. Ga rg Distributed Systems F all 94

  3. Intro duction 3 Semantics g j = bool i� g j = bool , g = last state in g m m g j = : l in i� : g j = l in i g j = 3 l in i� 9 i : g j = l in i j g j = l in , ! l in i� 9 i < j : g j = l in ^ g j = l in 1 2 1 2 r j = A: l in i� 8 g : g 2 l inear ( r ) : g j = l in r j = E: l in i� 9 g : g 2 l inear ( r ) : g j = l in � str ong p redicate: fo rmulas sta rting with A � we ak p redicate: fo rmulas sta rting with E . � Vija c y K. Ga rg Distributed Systems F all 94

  4. Intro duction 4 W eak Conjunctive Predicates A w eak conjunctive p redicate (W CP) is true fo r a given run if and only if there exists a global sequence consistent with that run in which all conjuncts a re true in some global state. � useful fo r bad o r undesirable p redicates � Example: the classical mutual exclusion p roblem. � detect erro rs that ma y b e hidden in some run due to race conditions. c � Vija y K. Ga rg Distributed Systems F all 94

  5. Intro duction 5 Imp o rtance of W eak Conjunctive Predicates � Su�cient fo r detection of any b o olean exp ression of lo cal p redicates. � Example x; y and z a re in three di�erent p ro cesses. Then, E: 3 ev en ( x ) ^ (( y < 0) _ ( z > 6)) � E: 3 ( ev en ( x ) ^ ( y < 0)) _ E : 3 ( ev en ( x ) ^ ( z > 6)) � the global p redicate is satis�ed b y only a �nite numb er of p ossible global states. � Example, E : 3 ( x = y ) , x and y a re in di�erent p ro cesses. ( x = y ) is not a lo c al p redicate Assume that x and y can only tak e values f 0 ; 1 g . � A : 2 bool can b e easily detected, why ? � Vija c y K. Ga rg Distributed Systems F all 94

  6. Intro duction 6 Conditions fo r W eak Conjunctive Predicates � LP : a lo cal p redicate in the p ro cess P i i � LP ( s ) : the p redicate LP is true in the state s . i i � s 2 r [ i ] : s o ccurs in the sequence r [ i ] . can assume k � n b ecause LP ^ LP is just another lo cal i j p redicate if LP and LP b elong to the same p ro cess. i j Theorem 1 E : 3 ( LP ^ LP ^ : : : LP ) is true for a run r 1 2 k i� for al l 1 � i � m 9 s 2 r [ i ] such that LP is true in state i i s , and s and s ar e inc omp ar able for i 6 = j . i i j s 1 t d t d - s 2 t d d - s d t k d - - A consisten t cut � Vija c y K. Ga rg Distributed Systems F all 94

  7. Intro duction 7 Detection of W eak Conjunctive Predicates: Centralized Algo rithm � One p ro cess serves as a check er. � Other p ro cesses : non-check er p ro cesses. Each non-check er p ro cess maintains its lo cal l cmv ector (last causal message vecto r). � F o r P , lcmvecto r[i] ( i 6 = j ) is the message id of the most j recent message from P (to anyb o dy) which has a causal i relationship to P . j � lcmvecto r[j] fo r the p ro cess P is the next message id that j P will use. j @ @ @ e u e u R @ e u e u - . . @ @ . @ @ . . @ @ . @ R R @ . . . U Lo cal Snapshot c � Vija y K. Ga rg Distributed Systems F all 94

  8. Intro duction 8 Algo rithm: Non-check er p ro cesses v ar lcmvecto r: arra y [1.. n ] of integer; init 8 i : i 6 = id :lcmvecto r[ i ] = 0; lcmvecto r[id] = 1; �rst�ag: b o olean init true; lo cal p red: Bo olean Exp ression; 2 F or sending do send (p rog, lcmvecto r, : : : ); lcmvecto r[id]++ ; �rst�ag:=true; 2 Up on receive (p rog, msg lcmvecto r, : : : ) do 8 i : lcmvecto r[i]:=m ax (lcm vecto r[i ], msg lcmvecto r[i]); 2 Up on (lo cal p red = true) ^ �rst�ag do �rst�ag := false; send (dbg, lcmvecto r) to the check er p ro cess; c � Vija y K. Ga rg Distributed Systems F all 94

  9. Intro duction 9 Optimizatio n Su�cient to send the lcmvecto r once after each message is sent irresp ective of the numb er of messages received. � l ocal ( s ) denote that the lo cal p redicate is true in state s . � f ir st ( s ) : the lo cal p redicate is true fo r the �rst time since the most recently sent message. � w cp ( s ; s ; :::; s ) : if s ; s ; :::s a re the states in di�erent m m 1 2 1 2 p ro cesses making the w cp true. Theorem 2 9 s ; :::; s : w cp ( s ; s ; :::s ) , m m 1 1 2 0 0 0 0 0 0 h9 s ; ::; s : w cp ( s ; s ; :::; s ) ^ 8 i : 1 � i � m : f ir st ( s ) i 1 m 1 2 m i 0 s s i i � @ � @ R - P i - P j @ � R @ � 0 s s j j c � Vija y K. Ga rg Distributed Systems F all 94

  10. Intro duction 10 Complexi t y � Space complexit y: the a rra y l cmv ector and is O ( n ) . � message complexit y is O ( m ) where m is the numb er of s s p rogram messages sent. � In addition, p rogram messages have to include time vecto rs. � Time complexit y � detection of lo cal p redicates � maintain time vecto rs ( O ( n ) = message ) . c � Vija y K. Ga rg Distributed Systems F all 94

  11. Intro duction 11 Check er Pro cess � Incoming debug messages from p ro cesses a re enqueued in the app rop riate queue. � assume that the check er p ro cess gets its message from any p ro cess in FIF O. Lemma 1 If the lcmve ctor at the he ad of one queue is less than the lcmve ctor at the he ad of any other queue, then the smal ler lcmve ctor may b e eliminate d fr om further c onsider ation in che cking to se e if the WCP is satis�e d. � Vija c y K. Ga rg Distributed Systems F all 94 Non-checker Non-checker Non-checker Process 1 Process 2 Process N queue 1 queue N Checker Checker Process

  12. Intro duction 12 F o rmal Description v ar q : : : q : queue of lcmvecto r; m 1 changed, new changed: set of f 1,2,..., m g 2 Up on recv(elem) from P do k insert( q , elem); k if (head( q ) = elem) then b egin k changed := f k g ; while (changed 6 = � ) b egin new changed := fg ; for i in changed, and j in f 1,2,...,m g do if ( : empty ( q ) ^ : empty ( q ) ) then i j b egin c � Vija y K. Ga rg Distributed Systems F all 94

  13. Intro duction 13 F o rmal Description [Contd.] if head ( q ) < head ( q ) then i j new changed:=new changed [ f i g ; if head ( q ) < head ( q ) then j i new changed:=new changed [ f j g ; end ; /* if */ changed := new changed; for i in changed do deletehead( q ); i end ;/* while */ if 8 i : : empty ( q ) then found:=true; i end ; /* if */ chang ed : the set of indices fo r which the head of the queues have b een up dated. 2 Theorem 3 The ab ove algorithm r e quir es at most O ( m p ) c omp arisons. c � Vija y K. Ga rg Distributed Systems F all 94

  14. Intro duction 14 Lo w er Bounds Theorem 4 A ny algorithm which determines whether ther e exists a set of inc omp ar able ve ctors of size m in m chains of size at most p , makes at le ast pm ( m � 1) = 2 c omp arisons. Pro of: Case 1 : p = 1 Case 2 : p > 1 � Vija c y K. Ga rg Distributed Systems F all 94

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