Relations and P osets 1 Goals of the lecture � Relations � P osets � A run o r a distributed computation � Happ ened-b efo re relation c � Vija y K. Ga rg Distributed Systems F all 94
Relations and P osets 2 Mo del of Distributed systems � events � b eginnin g of p ro cedure fo o � termination of ba r � send of a message � receive of a message � termination of a p ro cess � happ ened-b efo re relation Time 12:01 San Jose Withdra w $ 10 6 ? Time 12:04 � - Austin Dep osit $ 20 Comm uni cation Net w ork @ I @ R Time 11:58 New Y ork T ransfer $ 10 � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 3 Relation � X = any set a bina ry relation R is a subset of X � X . � Example: X = f a; b; c g , and R = f ( a; c ) ; ( a; a ) ; ( b; c ) ; ( c; a ) g . a b h h h c � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 4 Relation [Contd.] Re�exiv e : If fo r each x 2 X ; ( x; x ) 2 R : � Example: X is the set of natural numb ers, and R = f ( x; y ) j x divides y g : Irre�exiv e : F o r each x 2 X ; ( x; x ) 62 R : � Example: X is the set of natural numb ers, and R = f ( x; y ) j x less than y g : Re�exive o r irre�exive ? h - h h h - � 6 � 6 � � � � ? � h - h ? h - h � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 5 Relation [Contd.] Symmetric : ( x; y ) 2 R implies ( y ; x ) 2 R . � Examples: is sibling of, x mo d k = y mo d k : An ti-symmetric : ( x; y ) 2 R ; ( y ; x ) 2 R inplies x = y . � Examples: � , divides. Asymmetric : ( x; y ) 2 R implies ( y ; x ) 62 R . � Examples: is child of, < . c � Vija y K. Ga rg Distributed Systems F all 94
Relations and P osets 6 Relation [Contd.] T ransitiv e : ( x; y ) ; ( y ; z ) 2 R implies ( x; z ) 2 R . � Examples: is reachable from, < , divides. Puzzle: Example of a symmetric and transitive but not re�exive relation. � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 7 P a rtially Ordered Sets [P osets] P a rtial Order � @ � @ � @ � @ � R @ Re�exive Irre�exive T ransitive T ransitive Anti-symmetric Anti-symmetric Example: � Example: < Examples: X � X : Ground Set, (2 ; � ) is a irre�exive pa rtial o rder � ( N ; divides ) is a re�exive pa rtial o rder � ( R ; � ) is a re�exive pa rtial o rder (also a total o rder) � causalit y in a distributed system (later ..) c � Vija y K. Ga rg Distributed Systems F all 94
Relations and P osets 8 P osets [Contd.] Let Y � X , where ( X ; � ) is a p oset. In�m um : m = inf ( Y ) i� � 8 y 2 Y : m � y � 8 x 2 X : ( 8 y 2 Y : x � y ) ) x � m m is also called g l b of the set Y . Suprem um : s = sup ( Y ) i� ( s is also called l ub ) � 8 y 2 Y : y � s � 8 x 2 X : ( 8 y 2 Y : y � s ) ) s � x W e denote the glb of f a; b g b y a u b , and lub b y a t b . e f f f � @ I 6 � @ X = f a; b; c; d; e; f g � @ � @ d f f 8 9 c > > 6 7 � > > > > > > � < ( a; b ) ; ( a; c ) ; ( b; d ) ; = f b � Q k R = Q > > � > > Q > > > > Q � : ( c; f ) ; ( c; e ) ; ( d; e ) ; f a � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 9 Lattices � * sups and infs fo r �nite sets � � � � � � � H Lattices H H H H H H j H P oset S S � Let S b e any set, and 2 b e its p o w er set. The p oset (2 ; � ) is a lattice. � Set of rationals with usual � . � Set of global states � A lattice is an algeb raic system ( L; t ; u ) where t and u satisfy commutative, asso ciative and abso rption la ws. f f f e b f 7 � o S � C O 6 C � � S C � � S e d f f C � d f � � C 6 I @ @ � 6 C @ � 6 C � @ C c � @ f b f f � @ a b f f c 7 � � I @ I @ � � @ � @ � f a @ � f a � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 10 Monotone functions A function f : X ! Y is monotone i� 8 x; y 2 X : x � y ) f ( x ) � f ( y ) : � Examples � union, intersection � addition, multiplic ati on with p ositive numb er � clo cks in distribute d systems f � J � J � J � J g J J J J � � � � J J J J � � � � J J J J � y f � � y � J J J J � r � � r � g ( y ) J J J J � � � � f ( x ) r J J J J � � � � r r J J J J � � � g � � J � J � J � J J � J � J � J � f ( y ) � � � � J J J J r � � � � J J J J � � g ( x ) � � J J J J r r � � � � J J J J � � � � x x J J J J � � � � J J J J � � � � J J J J J� J� J� J � � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 11 Do wn-Sets and Up-Sets Let ( X ; < ) b e any p oset. � W e call a subset Y � X a do wn-set (alternatively , o rder ideal) if f 2 Y ^ e < f ) e 2 Y : � Simila rly , w e call Y � X an up-set (alternatively , o rder �lter) if e 2 Y ^ e < f ) f 2 Y : � W e use O ( X ) to denote the set of all do wn-sets of X . W e no w sho w a simple but imp o rtant lemma. Lemma 1 L et ( X ; < ) b e any p oset. Then, ( O ( X ) ; � ) is a lattic e. � Vija c y K. Ga rg Distributed Systems F all 94
Relations and P osets 12 Run 0 ; 1 1 ; 3 2 ; 3 3 ; 2 ( pc; x ) g - g - g - g r [1] x = x � 1 x = x � 1 send ( x ) � � � � � � � y = y + 3 � receiv e ( y ) y = 2 � y g - g - g - g r [2] 0 ; 1 1 ; 4 2 ; 3 3 ; 6 ( pc; y ) � Each p ro cess P in a run generates an execution trace i s e s : : : e s , which is a �nite sequence of lo cal states i; 0 i; 0 i; 1 i; l � 1 i; l and events in the p ro cess P . i � state = values of all va riables, p rogram counter � event = internal, send, receive � A run r is a vecto r of traces with r [ i ] as the trace of the p ro cess P . i c � Vija y K. Ga rg Distributed Systems F all 94
Relations and P osets 13 Relations 0 ; 1 1 ; 3 2 ; 3 3 ; 2 ( pc; x ) g - g - g - g r [1] x = x � 1 x = x � 1 send ( x ) � � � � � � � y = y + 3 � receiv e ( y ) y = 2 � y g - g - g - g r [2] 0 ; 1 1 ; 4 2 ; 3 3 ; 6 ( pc; y ) � s � t if and only if s imme diately p recedes t in the trace 1 r [ i ] . � s:next = t o r t:pr ev = s whenever s � t . 1 � � = irre�exive transitive closure of � . 1 � � = re�exive transitive closure of � . 1 � event e in the trace r [ i ] ; event f in the trace r [ j ] if e is the send of a message and f is the receive event of the same message. c � Vija y K. Ga rg Distributed Systems F all 94
Relations and P osets 14 Relations [Contd.] 0 ; 1 1 ; 3 2 ; 3 3 ; 2 ( pc; x ) g - g - g - g r [1] x = x � 1 x = x � 1 send ( x ) � � � � � � � y = y + 3 � receiv e ( y ) y = 2 � y g - g - g - g r [2] 0 ; 1 1 ; 4 2 ; 3 3 ; 6 ( pc; y ) c ausal ly pr e c e des relation � the transitive closure of union of � and ; . That is, s ! t i� 1 1. ( s � t ) _ ( s ; t ) , o r 1 2. 9 u : ( s ! u ) ^ ( u ! t ) s and t a re concurrent (denoted b y s jj t ) if : ( s ! t ) ^ : ( t ! s ) . c � Vija y K. Ga rg Distributed Systems F all 94
Recommend
More recommend