Conjunctive Predicates 1 Goals of the lecture: Conjunctive - - PowerPoint PPT Presentation

conjunctive predicates 1 goals of the lecture conjunctive
SMART_READER_LITE
LIVE PREVIEW

Conjunctive Predicates 1 Goals of the lecture: Conjunctive - - PowerPoint PPT Presentation

Conjunctive Predicates 1 Goals of the lecture: Conjunctive Predicates Direct dep endency algo rithm T ok en based decentralized algo rithm Channel Predicates Reference: Chapter 5. Vija c y K. Ga rg


slide-1
SLIDE 1 Conjunctive Predicates 1 Goals
  • f
the lecture: Conjunctive Predicates
  • Direct
dep endency algo rithm
  • T
  • k
en based decentralized algo rithm
  • Channel
Predicates Reference: Chapter 5. c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-2
SLIDE 2 Conjunctive Predicates 2 Algo rithm fo r application p ro cess P i
  • Assume
fully connected net w
  • rk
  • Mattern's
vecto r clo ck
  • Notation:
  • (i;
k ): the k th state
  • n
p ro cess P i (o r simply k ) c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-3
SLIDE 3 Conjunctive Predicates 3 Monito r Pro cesses fo r W CP
  • Monito
r p ro cesses resp
  • nsible
fo r sea rching fo r a W CP cut.
  • The
tok en sto res a candidate cut.
  • The
tok en also sto res info rmation to determine whether the candidate cut is consistent. c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-4
SLIDE 4 Conjunctive Predicates 4 Info rmal Description
  • A
tok en is sent to a p ro cess P i
  • nly
when the current cut is not consistent. Sp ecically , when current state from P i happ ened b efo re some
  • ther
state in the candidate cut.
  • Once
the monito r p ro cess fo r P i has eliminated the current state,
  • receive
a new state from the applicatio n p ro cess
  • check
fo r consistency conditions again.
  • This
p ro cess is rep eated until
  • all
states a re eliminate d from some p ro cess P i
  • r
  • the
W CP is detected. c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-5
SLIDE 5 Conjunctive Predicates 5 T
  • k
en
  • A
monito r p ro cess is active
  • nly
if it has the tok en.
  • tok
en consists
  • f
t w
  • vecto
rs G and col
  • r
.
  • G
is a global state vecto r rep resents the candidate global cut
  • G[i]
= k indicates that state (i; k ) is pa rt
  • f
the current cut.
  • W
e maintain the inva riant that G[i] = k implies that any global cut C with (i; s) 2 C and s < k cannot satisfy the W CP.
  • c
  • lor
, indicates which states have b een eliminate d.
  • If
col
  • r
[i] = r ed then state (i; G[i]) has b een eliminated and can never satisfy the global p redicate.
  • If
col
  • r
[i] = g r een, then there is no state in G such that (i; G[i]) happ ened b efo re that state. c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-6
SLIDE 6 Conjunctive Predicates 6 Monito r Pro cess Algo rithm v ar candidate:arra y[1..n]
  • f
in teger;
  • n
receiving the tok en (G,color) while (color[i] = red) do receiv e candidate from application pro cess P i if (candidate.v clo c k[i] > G[i]) then G[i] := candidate.v clo c k[i]; color[i]:=green; endwhile for j 6= i: if (candidate.v clo c k[j] > G[j]) then G[j] := candidate.v clo c k[j]; color[j]:=red; endif endfor if (9 j: color[j] = red) then send tok en to P j else detect := true; Figure 1: Monitor Pro cess Algorithm c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-7
SLIDE 7 Conjunctive Predicates 7 Co rrectness
  • f
W CP Detection Algo rithm The algo rithm co rrectly detects the rst cut that satises a W CP. Lemma 1 F
  • r
any i, 1. G[i] 6= ^ col
  • r
[i] = r ed ) 9j : j 6= i : (i; G[i]) ! (j; G[j ]); 2. col
  • r
[i] = g r een ) 8k : (i; G[i]) 6! (k ; G[k ]); 3. (col
  • r
[i] = g r een)^(col
  • r
[j ] = g r een) ) (i; G[i])k(j; G[j ]). 4. If (col
  • r
[i] = r ed), then ther e is no glob al cut satisfying the WCP which includes (i; G[i]). c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-8
SLIDE 8 Conjunctive Predicates 8 Analysis
  • f
Single-T
  • k
en W CP Algo rithm
  • time
complexit y: the total computation time fo r all p ro cesses is O (n 2 m)
  • Every
time a state is eliminate d, O (n) w
  • rk
is p erfo rmed
  • There
a re at most mn states.
  • Message
complexit y: the total numb er
  • f
messages O (mn).
  • the
tok en is sent at most mn times.
  • each
monito r receives at most m messages from its applicati
  • n
p ro- cess.
  • Communication
bit complexit y: O (n 2 m).
  • size
  • f
b
  • th
the tok en and the candidate messages is O (n).
  • space
complexit y: O (mn) space is required b y the algo rithm fo r every p ro cess.
  • the
buer fo r holding messages c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-9
SLIDE 9 Conjunctive Predicates 9 Channel Predicates
  • A
channel p redicate: any b
  • lean
function
  • f
the accumula- tion
  • f
send and receive events
  • n
that channel.
  • Only
uni-directional channels s; t: states at dierent p ro cesses. s:send[t:p]: string
  • f
all messages sent at
  • r
b efo re state s from s:p to t:p. t:r eceiv ed[s:p]: string
  • f
all messages received at
  • r
b efo re state t from t:p to s:p. The channel p redicate can then b e written as: c j (s:send[t:p]; t:r eceiv ed[s:p])
  • r
in sho rt notation as: c j (S; R )
  • c
j (s:send[t:p]; t:r eceiv e[s:p])
  • Requirements
fo r monotonicit y c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-10
SLIDE 10 Conjunctive Predicates 10 Examples Example 1 Empty channels: len(S)=len(R): This sa ys that if a channel p redicate is false, then it cannot b e made true b y sending mo re messages without receiving mo re messages. Example 2 Nonempty channels: (ns > nr ): (ns
  • nr
> nk ) /* at least k messages in the channel */ c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-11
SLIDE 11 Conjunctive Predicates 11 GCP-cuts C : global cuts that satisfy a GCP with monotone channel p red- icates
  • C
  • D
i 8i : C [i]
  • D
[i]. W e sho w that the concept
  • f
rst cut that satises a GCP is w ell-dened. Theorem 2 If C ; D 2 C , then their gr e atest lower b
  • und
is also in C . Pr
  • f:
c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-12
SLIDE 12 Conjunctive Predicates 12 Example: no rst cut in general p redicate: There a re an
  • dd
numb er
  • f
messages in the channel. true
  • nly
at p
  • ints
C [1] and D [1] fo r P 1 , and C [2] and D [2] fo r P 2 . the GCP is true in the cut C and D but not in their greatest lo w er b
  • und.

C[1] D[1] D[2] C[2]

Figure 2: consisten t cuts satisfying a GCP is not a lattice. c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-13
SLIDE 13 Conjunctive Predicates 13 Non-check er p ro cess algo rithm initial l y 8j : j 6= i :lcmvecto r[j ] = 0; lcmvecto r[i] = 1; rsag = true;incsend = increcv = ;; F
  • r
sending m do send (lcmvecto r, m); lcmvecto r[i]++ ; rstag:=true; incsend:= incsend
  • m;
Up
  • n
receive (msg lcmvecto r, m) do lcmvecto r:=max (lcm vecto r, msg lcmvecto r); rstag:=true; increcv:= increcv
  • m;
Up
  • n
(lo cal p red = true)^ rstag do send (lcmvecto r,incsend,increcv) to check er ; rstag := false; incsend:=increcv:=;; c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-14
SLIDE 14 Conjunctive Predicates 14 Data Structures
  • f
the Check er Pro cess
  • p
er-p ro cess data
  • cut:a
rra y[1..n]
  • f
struct v:vecto r
  • f
integer; colo r:red, green
  • The
colo r
  • f
a state is either red
  • r
green. green: the current state is concurrent with the current states from all
  • ther
green p ro cesses. red: the current state cannot b e pa rt
  • f
a GCP cut
  • A
FIF O queue
  • f
successive lo cal snapshots from this p ro cess.
  • q:a
rra y[1..n]
  • f
queues
  • f
struct
  • v:vecto
r
  • f
integer;
  • incsend:a
rra y[1..n]
  • f
sequences
  • f
messages;
  • increcv:a
rra y[1..n]
  • f
sets
  • f
messages; c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-15
SLIDE 15 Conjunctive Predicates 15 P er-Channel Data three data structures fo r each channel: 1. A p ending-send list: messages sent but not y et received S[i,j]: sequence
  • f
messageinfo; 2. A p ending-receive list:
  • rdered
list
  • f
message sequence num- b ers. R[i,j]: sets
  • f
messageinfo ; 3. A CP-state ag. V alue
  • f
channel p redicates
  • T
(true)
  • nly
if the channel p redicate fo r that channel is true fo r the current cut
  • F
(false)
  • nly
if the channel p redicate fo r that channel is false fo r the current cut. The CP-state ag can tak e the value X (unk
  • wn)
at any time. cp[i,j]:X,F,T c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-16
SLIDE 16 Conjunctive Predicates 16 F
  • rmal
description S[1..n,1..n], R[1..n,1..n] : sequence
  • f
message; cp[1..n,1..n] : fX, F, Tg; cut : arra y[1..n]
  • f
struct f v : v ector
  • f
in teger; color : fred, greeng; incsend, increcv : sequence
  • f
messages g initially cut[i].v = 0; cut[i].color = red; S[i,j], R[i,j] = ;; rep eat while (9 i : (cut[i].color = red) ^ (q[i] 6= ;)) cut[i] := receiv e(q[i]); pain t-state(i); up date-c hannels(i); endwhile if (9 i,j : cp[i,j] = X ^ cut[i].color = green ^ cut[j].color = green) then cp[i,j] := c hanp(S[i,j]); if (cp[i,j] = F) then if (send-mono(i,j)) cut[j].color := red; else cut[i].color := red; /* receiv e-mono(i,j) */ un til (8 i : cut[i].color = green) ^ (8 i,j : cp[i,j] = T) detect := true; c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-17
SLIDE 17 Conjunctive Predicates 17 Up date Channels up date-c hannels(i) for (j : cut[i].incsend[j] 6= ;) do S := S[i,j]; R := R[i,j]; S[i,j] := S
  • (cut[i].incsend[j]
  • R
); R[i,j] := R
  • cut[i].incsend[j];
if (: send-mono(i,j) _ cp[i,j] = T ) cp[i,j] := X; for (j : cut[i].increcv[j] 6= ;) do S := S[j,i]; R := R[j,i]; R[j,i] := R
  • (cut[i].increcv[j]
  • S
); S[j,i] := S
  • cut[i].increcv[j];
if (: recv-mono(j,i) _ cp[j,i] = T ) cp[j,i] := X; c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-18
SLIDE 18 Conjunctive Predicates 18 Overhead analysis
  • Time
complexit y:
  • any
state is compa red to at most n
  • ther
states.
  • There
a re mn states in all. Therefo re, mn 2 compa risons
  • at
most t w
  • evaluations
  • f
the p redicate p er message.
  • at
most 2mn message send and receive events.
  • each
p redicate evaluation tak es at most c time units, The total time sp ent is 2mnc.
  • Space
complexit y
  • n
queues each with at most m elements. assume that comp
  • nent
  • f
each vecto r and every message: a constant numb er
  • f
bits.
  • Therefo
re, fo r each queue: O (mn).
  • Summing
up all incremental channel histo ries, w e get O (m).
  • T
  • tal
space required b y the check er p ro cess is O (mn 2 ). c Vija y K. Ga rg Distributed Systems Sp ring 96
slide-19
SLIDE 19 Conjunctive Predicates 19
  • Message
Complexit y Every p ro cess sends at most m messages to the check er p ro cess. Using same assumptions (space complexit y): O (mn) bits sent b y each p ro cess. c Vija y K. Ga rg Distributed Systems Sp ring 96