Clo cks [Contd.] 1 Goals of the lecture Direct dep - - PowerPoint PPT Presentation

clo cks contd 1 goals of the lecture direct dep endency
SMART_READER_LITE
LIVE PREVIEW

Clo cks [Contd.] 1 Goals of the lecture Direct dep - - PowerPoint PPT Presentation

Clo cks [Contd.] 1 Goals of the lecture Direct dep endency clo cks Pred and Succ functions Matrix clo cks Prop erties of matrix clo cks Vija c y K. Ga rg Distributed Systems Sp ring 96 Clo


slide-1
SLIDE 1 Clo cks [Contd.] 1 Goals
  • f
the lecture
  • Direct
dep endency clo cks
  • Pred
and Succ functions
  • Matrix
clo cks
  • Prop
erties
  • f
matrix clo cks c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-2
SLIDE 2 Clo cks [Contd.] 2 Overhead
  • f
the vecto r clo ck algo rithm m = #
  • f
messages sent/recd b y any p ro cess n = #
  • f
p ro cesses
  • Space
  • verhead
: n log m
  • Time
  • verhead
: O (n)
  • Communication
  • verhead
: n log m c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-3
SLIDE 3 Clo cks [Contd.] 3 Direct Dep endency Clo cks
  • Main
dra wback
  • f
the vecto r clo ck algo rithm
  • O
(N ) integers with every message
  • Direct
Dep endency Clo cks require
  • nly
  • ne
integer to b e app ended to each message
  • Used
in Lamp
  • rt's
algo rithm fo r mutual exclusion c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-4
SLIDE 4 Clo cks [Contd.] 4 Algo rithm F
  • r
any initial state s: (8i : i 6= s:p : s:v [i] = 0) ^ (s:v [s:p] = 1) Rule fo r a send event (s; snd; t)
  • r
an internal (s; int; t): t:v [t:p] := s:v [t:p] + 1; Rule fo r a receive event (s; r cv (u); t): t:v [t:p] := max(s:v [t:p]; u:v [u:p]) + 1; t:v [u:p] := max (u:v [u:p]; s:v [u:p]);
  • 1
1 1 @ @ @ @ @ @ R 1 1 2 @ @ @ @ @ @ R 2 2 3 c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-5
SLIDE 5 Clo cks [Contd.] 5 Prop erties
  • f
Direct Dep endency Clo cks
  • p
rojection
  • n
ith comp
  • nent
results in the logical clo ck algo rithm. Lemma 1 s ! t ) s:v [s:p] < t:v [t:p] Converse ? Lemma 2 (8s; t :: s 6! t ) :(s:v [s:p]
  • t:v
[s:p]) Converse ? c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-6
SLIDE 6 Clo cks [Contd.] 6 Direct Dep endency s ! d t
  • (s
  • t)
_ (9 q ; r : s
  • q
^ q ; r ^ r
  • t)
  • @
@ @ @ @ R s s s t Lemma 3 8 s; t : s:p 6= t:p : :(s ! d t) ) :(s:v [s:p]
  • t:v
[s:p]) ! ! d c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-7
SLIDE 7 Clo cks [Contd.] 7 Higher Dimensional Clo cks W e describ e a matrix clo ck and its p rop erties b elo w. T
  • initialize:
M k [; ] := 0; M k [k ; k ] := M k [k ; k ] + 1; T
  • send
a message: T ag message with M k [; ]; M k [k ; k ] := M k [k ; k ] + 1; incr ement lo c al clo ck Up
  • n
receipt
  • f
a message tagged with W [; ]: for i := 1 to n do if (M k [i; i] < W [i; i]) then M k [i; ] := W [i; ]; c
  • py
ve ctor clo ck for (i; W [i; i]) M k [k ; k ] := M k [k ; k ] + 1; incr ement lo c al clo ck M k [k ; ] := diag
  • nal
(M k ); c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-8
SLIDE 8 Clo cks [Contd.] 8 c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-9
SLIDE 9 Clo cks [Contd.] 9 Interval
  • e
t f t @ @ R g t h t e
  • f
i there is no communication b et w een the state e and f .
  • is
an equivalence relation. F urther,
  • is
a congruence w.r.t. !. That is, s
  • s
) 8u : u:p 6= s:p : (s ! u
  • s
! u)^(u ! s
  • u
! s ) Congruence exploited b y assigning same identier to all states in the same equivalence class (interval). c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-10
SLIDE 10 Clo cks [Contd.] 10 Interval [contd.]
  • @
@ @ @ @ @ @ @ R A A A A A A A A A A A A A A A U
  • (1,1)
  • (2,1)
(1,4) (3,1) (3,2) (3,3) (2,2) (1,2) (1,3) c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-11
SLIDE 11 Clo cks [Contd.] 11 Pred and Succ functions
  • S
i = set
  • f
lo cal states at P i
  • Defn
  • f
Pred : pr ed:u:i = max fv j v 2 S i ^ v ! ug returns ? if the ab
  • ve
set is empt y . Simila r defn fo r Succ Because
  • f
congruence, can use intervals instead
  • f
states. Lemma 4 (p; i) = pr ed:(q ; j ):p ) (8 k : k > i : (p; k ) 6! (q ; j )) c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-12
SLIDE 12 Clo cks [Contd.] 12 F
  • r
V ecto r Clo cks V n k = vecto r clo ck in the interval (k ; n) 8i; k ; n : k 6= i : pr ed:(k ; n):i = V n k [i]
  • (1;
1) [1; 0; 0] (1; 2) [2; 0; 0] (2; 1) [0; 1; 0] (3; 1) [0; 0; 1] @ @ @ @ @ @ R (2; 2) [1; 2; 0] (2; 3) [1; 3; 0] @ @ @ @ @ @ R (3; 2) [1; 2; 2] c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-13
SLIDE 13 Clo cks [Contd.] 13 Prop erties
  • f
Matrix Clo ck
  • F
  • r
P i ; i th ro w implements the vecto r clo ck
  • M
n k [k ; k ] = n
  • Diagonal
is same as the i th ro w c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-14
SLIDE 14 Clo cks [Contd.] 14 Prop erties
  • f
Matrix Clo ck [Contd.]
  • i
6= j ) (j; M n k [i; j ]) = pr ed:(i; M n k [i; i]):j
  • i
6= j ) pr ed:(pr ed:(k ; n):i):j = (j; M n k [i; j ]) h h
  • h
P i P j P k (k ; n) pr ed:(k ; n):i = M n k [k ; i] pr ed:(pr ed:(k ; n):i):j c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-15
SLIDE 15 Clo cks [Contd.] 15 Disca rding Obsolete Info rmation If p ro cess s:p nds that its s:p column is unifo rmly bigger than r :v [s:p; s:p] (that is, its lo cal clo ck in some p revious state r ), then the info rmation at r has b een received b y all p ro cesses. Lemma 5 L et s:p = r :p. If (8i : s:v [i; s:p]
  • r
:v [r :p; r :p]), then 8t : tks : r ! t. Pro
  • f:
  • P
s:p P i s r s s
  • @
@ @ @ @ R
  • t
  • @
@ @ @ @ R
  • tks
) pr ed(s):i ! t (1) (8i : s:v [i; s:p]
  • r
:v [r :p; r :p]) ) r
  • pr
ed:(pr ed(s):i):(s:p) (2) F rom the ab
  • ve
t w
  • equations:
r ! t. c Vija y K. Ga rg Distributed Systems Sp ring 96