Synchronous Ordering 1 Goals of the lecture � Hiera rchy of communication mo des � Motivation fo r synchronous o rdering � Cro wn � Su�cient conditions fo r synchronous o rdering � Implementation rules � Safet y theo rem � Liveness c � Vija y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 2 Comm unicatio n Mo des � FIF0 P 3 P 2 s � s = ) : ( r � r ) 1 2 2 1 P 1 � sequence numb ers a re su�cient to implement FIF O. � Causally Ordered P 3 P 2 s ! s = ) : ( r � r ) 1 2 2 1 P 1 � matrix clo cks a re su�cient to implement Causal o rdering. � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 3 Comm unicatio n Mo des [Contd.] � Synchronous Ordering (SYNC) 1 3 - 6 9 T : E ! 1 N : 8 s; r ; e; f 2 E 2 s ; r = ) T( s ) = T( r ) ? - 6 3 e � f = ) T( e ) < T( f ) - 1 2 � time diagram of a synchronous computation can b e dra wn such that all message a rro ws a re vertical. � any o rder clo ck is insu�cient to implement synchronous o rdering. � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 4 Motivation fo r Synch. p p 1 2 1: insert ( queue q , c ) 1: insert ( queue q , a ) 1 2 2: insert ( queue q , d ) 2: insert ( queue q , b ). 2 1 queue q - 1 * � � I @ � @ � � @ � in ( queue q , d) 2 � � @ � � � � @ queue q � s s - 2 � * @ � � pro cess p in ( queue q , c) 1 1 @ � � � @ � � @ � s � @ s - pro cess p in ( queue q , a) in ( queue q , b) 2 2 1 queue q 1 - - - 6 6 6 6 6 6 p : 2 p : 2 p : 2 1 1 1 queue q 2 s s - s s - s s - 6 6 6 p : 1 p : 1 p : 1 1 1 1 s s - s s - s s - p : 1 p : 2 p : 1 p : 2 p : 1 p : 2 2 2 2 2 2 2 q c b q c b q b c 1 1 1 State q d a q a d q a d 2 2 2 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 5 Cro wns in Distributed Computation � A computation is synchronous i� there do es not exist a se- quence of send and co rresp onding receive events such that s ! r ; s ! r ; : : : ; s ! r ; s ! r : 0 E 1 1 E 2 k � 2 E k � 1 k � 1 E 0 � such a structure is called cro wn. � Example: r r s r 1 2 3 P 3 (A) (B) s r 2 1 P 2 s s 3 P 1 (A) : Cro wn of size 2 s r s r 1 2 1 2 (B) : Strong Cro wn of size 3 s ! r ; s ! r s � r ; s � r ; s � r 1 2 2 1 1 2 2 3 3 1 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 6 Algo rithm � Commit P oint of a Message s e r 1 2 P 2 P 1 r s 1 2 � Prio rit y Rule (RP) 0 r r s P P 3 3 s e s e P P 0 2 2 s s r P P 1 1 r r (b) The resulting message ordering (a) The message along with the underlying message � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 7 Algo rithm [Contd.] � Send Condition s � s = ) r ! r 1 2 1 2 � Receive Condition s � s = ) s :ack � s 1 2 1 2 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 8 Implem entati on � activ e f f :ack P j P i e e:ack � passiv e - � activ e � Send Condition (SC) s � s = ) r ! r 1 2 1 2 (SP) s � s = ) s :ack � s (W ait fo r ack) 1 2 1 2 � Receive Condition (R C) s � r = ) : ( r ! r ) 1 2 2 1 (RP) s � r = ) s :ack � r :ack (Send ack if no ack p ending ) 1 2 1 2 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 9 Basic Lemma Lemma 1 ( s ! r ) and (SC) = ) ( r ! r ) _ ( s � r ) 1 2 1 2 1 2 Pro of: r 2 - s r 1 - � � � � r 1 - � � � � s - � s r 1 2 � � - s 1 Case 1 Case 2 r 2 - s r ! r 3 2 r 1 s � s = ) r ! r - 1 3 1 3 � � = ) r ! r 1 2 � � � s - s s 1 3 Case 3 2 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 10 Cro wn and Strong Cro wn Lemma 2 Given SC and R C. 2 CR = ) 2 SCR. Pro of: s ! r ; s ! r 1 2 2 1 Let : ( s � r ) 1 2 = ) r ! r S C 1 2 = ) : ( s � r ) R C 2 1 : ( s � r ) ^ ( s ! r ) = ) r ! r 2 2 1 2 1 2 1 0 Lemma 3 Given SC, R C. CR( k ) = ) SCR ( k ) Pro of: s ! r ; s ! r s.t. : ( s � r ) i � 1 i i i +1 i i +1 = ) r ! r i i +1 Therefo re, s ! r ; s ! r reduced to s ! r . 2 i � 1 i i i +1 i � 1 i +1 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 11 Safet y : S Y N C H , C R ) S C R s � r ; s � r ; � � � ; s � r 0 1 1 2 0 k � 1 i.e. P ( s ) = P ( r ) i ( i +1) mo d k F rom PR : P ( s ) > P ( r ) i i w e get P ( s ) < P ( r ) 0 0 � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 12 Liveness � If P w ants to send a message then it can eventually succeed. k � k smallest p ro cesses will eventually b e in active state. � Vija c y K. Ga rg Distributed Systems F all 94
Synchronous Ordering 13 Overhead � Prio rit y Rule � fo r every message ( s; r ) if P ( s ) < P( r ) : + one control message and + dela y of less than 2 t units of time. � fo r every message ( s; r ) if P ( s ) > P( r ) : + no control message and + no dela y . � Send and Receive Proto col + one control message and + dela y is upp er b ounded b y nt , where n is equal to the numb er of p ro cesses. � Vija c y K. Ga rg Distributed Systems F all 94
Recommend
More recommend