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

intro duction 1 goals of the lecture w eak conjunctive
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 1 Intro duction 1 Goals
  • f
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 c Vija y K. Ga rg Distributed Systems F all 94
slide-2
SLIDE 2 Intro duction 2 Logic fo r Global Predicates
  • Three
syntactic catego ries in the logic
  • b
  • l,
lin and form.
  • Syntax:
fo rm ::= A: lin j E: lin lin ::= 3 lin j lin ^ lin j :lin j b
  • l
b
  • l
::= a p redicate
  • ver
a global state
  • bool
: b
  • lean
exp ression dened
  • n
a single global state
  • f
the system.
  • Example:
if the global state has (x = 3; y = 6), then the bool (x
  • y
) is true.
  • l
in is a temp
  • ral
fo rmula dened
  • ver
a global sequence.
  • bool
is true in g if it is true in the last state
  • f
g .
  • 3
lin: there exists a p rex
  • f
g such that lin is true fo r the p rex.
  • 2
and _: duals
  • f
3 and ^.
  • A
form is dened fo r a run and it is simply a lin qualied with universal (A :)
  • r
existential (E :) quantier. c Vija y K. Ga rg Distributed Systems F all 94
slide-3
SLIDE 3 Intro duction 3 Semantics g j = bool i g m j = bool , g m = last state in g g j = :l in i :g j = l in g j = 3l in i 9i : g i j = l in g j = l in 1 , ! l in 2 i 9i < j : g i j = l in 1 ^ g j j = l in 2 r j =A:l in i 8g : g 2 l inear (r ) : g j = l in r j =E:l in i 9g : g 2 l inear (r ) : g j = l in
  • str
  • ng
p redicate: fo rmulas sta rting with A
  • we
ak p redicate: fo rmulas sta rting with E . c Vija y K. Ga rg Distributed Systems F all 94
slide-4
SLIDE 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
  • nly
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
  • 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
slide-5
SLIDE 5 Intro duction 5 Imp
  • rtance
  • f
W eak Conjunctive Predicates
  • Sucient
fo r detection
  • f
any b
  • lean
exp ression
  • f
lo cal p redicates.
  • Example
x; y and z a re in three dierent p ro cesses. Then, E:3ev 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 satised b y
  • nly
a nite numb er
  • f
p
  • ssible
global states.
  • Example,
E : 3(x = y ), x and y a re in dierent p ro cesses. (x = y ) is not a lo c al p redicate Assume that x and y can
  • nly
tak e values f0; 1g.
  • A
: 2bool can b e easily detected, why ? c Vija y K. Ga rg Distributed Systems F all 94
slide-6
SLIDE 6 Intro duction 6 Conditions fo r W eak Conjunctive Predicates
  • LP
i : a lo cal p redicate in the p ro cess P i
  • LP
i (s): the p redicate LP i is true in the state s.
  • s
2 r [i]: s
  • ccurs
in the sequence r [i]. can assume k
  • n
b ecause LP i ^ LP j is just another lo cal p redicate if LP i and LP j b elong to the same p ro cess. Theorem 1 E : 3(LP 1 ^ LP 2 ^ : : : LP k ) is true for a run r i for al l 1
  • i
  • m
9s i 2 r [i] such that LP i is true in state s i , and s i and s j ar e inc
  • mp
ar able for i 6= j . d d d d d t t t d t A consisten t cut
  • s
1 s 2 s k c Vija y K. Ga rg Distributed Systems F all 94
slide-7
SLIDE 7 Intro duction 7 Detection
  • f
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
  • r
P j , lcmvecto r[i] (i 6= j ) is the message id
  • f
the most recent message from P i (to anyb
  • dy)
which has a causal relationship to P j .
  • lcmvecto
r[j] fo r the p ro cess P j is the next message id that P j will use. e e e u u u e u Lo cal Snapshot
  • @
@ @ @ R @ @ @ @ R @ @ @ @ R U . . . . . . . . . c Vija y K. Ga rg Distributed Systems F all 94
slide-8
SLIDE 8 Intro duction 8 Algo rithm: Non-check er p ro cesses v ar lcmvecto r: arra y [1..n]
  • f
integer; init 8i : i 6= id :lcmvecto r[i] = 0; lcmvecto r[id] = 1; rstag: b
  • lean
init true; lo cal p red: Bo
  • lean
Exp ression; 2 F
  • r
sending do send (p rog, lcmvecto r, : : : ); lcmvecto r[id]++ ; rstag:=true; 2 Up
  • n
receive (p rog, msg lcmvecto r, : : : ) do 8i :lcmvecto r[i]:=m ax (lcm vecto r[i ], msg lcmvecto r[i]); 2 Up
  • n
(lo cal p red = true)^ rstag do rstag := false; send (dbg, lcmvecto r) to the check er p ro cess; c Vija y K. Ga rg Distributed Systems F all 94
slide-9
SLIDE 9 Intro duction 9 Optimizatio n Sucient to send the lcmvecto r
  • nce
after each message is sent irresp ective
  • f
the numb er
  • f
messages received.
  • l
  • cal
(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 1 ; s 2 ; :::; s m ): if s 1 ; s 2 ; :::s m a re the states in dierent p ro cesses making the w cp true. Theorem 2 9s 1 ; :::; s m : w cp(s 1 ; s 2 ; :::s m ) , h9s 1 ; ::; s m : w cp(s 1 ; s 2 ; :::; s m ) ^ 8i : 1
  • i
  • m
: f ir st(s i )i
  • @
@ R @ @ R
  • P
j s i s j s i s j P i c Vija y K. Ga rg Distributed Systems F all 94
slide-10
SLIDE 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 s ) where m s is the numb er
  • f
p rogram messages sent.
  • In
addition, p rogram messages have to include time vecto rs.
  • Time
complexit y
  • detection
  • f
lo cal p redicates
  • maintain
time vecto rs (O (n)=message ). c Vija y K. Ga rg Distributed Systems F all 94
slide-11
SLIDE 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
  • f
  • ne
queue is less than the lcmve ctor at the he ad
  • f
any
  • ther
queue, then the smal ler lcmve ctor may b e eliminate d fr
  • m
further c
  • nsider
ation in che cking to se e if the WCP is satise d.

Non-checker Process 1 Non-checker Non-checker Process 2 Process N queue 1 queue N Process Checker Checker

c Vija y K. Ga rg Distributed Systems F all 94
slide-12
SLIDE 12 Intro duction 12 F
  • rmal
Description v ar q 1 : : : q m : queue
  • f
lcmvecto r; changed, new changed: set
  • f
f1,2,...,mg 2 Up
  • n
recv(elem) from P k do insert(q k , elem); if (head(q k ) = elem) then b egin changed := f k g; while (changed 6= ) b egin new changed := fg; for i in changed, and j in f1,2,...,m gdo if (:empty (q i ) ^ :empty (q j )) then b egin c Vija y K. Ga rg Distributed Systems F all 94
slide-13
SLIDE 13 Intro duction 13 F
  • rmal
Description [Contd.] if head(q i ) < head(q j ) then new changed:=new changed [ fig; if head(q j ) < head(q i ) then new changed:=new changed [ fjg; end; /* if */ changed := new changed; for i in changed do deletehead(q i ); end;/* while */ if 8i : :empty (q i ) then found:=true; end; /* if */ chang ed: the set
  • f
indices fo r which the head
  • f
the queues have b een up dated. Theorem 3 The ab
  • ve
algorithm r e quir es at most O (m 2 p) c
  • mp
arisons. c Vija y K. Ga rg Distributed Systems F all 94
slide-14
SLIDE 14 Intro duction 14 Lo w er Bounds Theorem 4 A ny algorithm which determines whether ther e exists a set
  • f
inc
  • mp
ar able ve ctors
  • f
size m in m chains
  • f
size at most p, makes at le ast pm(m
  • 1)=2
c
  • mp
arisons. Pro
  • f:
Case 1 : p = 1 Case 2 : p > 1 c Vija y K. Ga rg Distributed Systems F all 94