Causal Ordering
Causal Ordering
Concurrent events:
• Two distinct events a and b are said to be concurrent ( denoted by a||b ) if
a → b and b → a
A space-time diagram
Lamport’s Logical Clock
Each process i keeps a clock Ci
• → is a par6al order
BUT
Update rules:
• Events a and b are causally related iff ta < tb or tb < ta, else they are
concurrent
• Message size increases since each message needs to be tagged with the
vector
• Size can be reduced in some cases by only sending values that have
changed
Global State Recording
Global State Collection
• Applications:
– Checking “stable” properties, checkpoint &
recovery
• Issues:
– Need to capture both node and channel
states
– system cannot be stopped
– no global clock
Notations
Some notations:
– LSi: Local state of process i
– send(mij) : Send event of message mij from
process i to process j
– rec(mij) : Similar, receive instead of send
– time(x) : Time at which state x was recorded
– time (send(m)) : Time at which send(m)
occurred
Definitions
• send(mij) є LSi iff time(send(mij)) < time(LSi)
• transit(LSi, LSj)
= { mij | send(mij) є LSi and rec(mij) ∉ LSj }
• inconsistent(LSi, LSj)
= { mij | send(mij) ∉ LSi and rec(mij) є LSj }
Definitions
• Global state: collection of local states
GS = {LS1, LS2,…, LSn}
• GS is consistent iff
for all i, j, 1 ≤ i, j ≤ n,
inconsistent(LSi, LSj) = Ф
• GS is transitless iff
for all i, j, 1 ≤ i, j ≤ n,
transit(LSi, LSj) = Ф
• One process acts as initiator, starts the state collection by following the
marker sending rule below.
• The state collected may not be any state that actually happened in reality,
rather a state that “could have” happened
• Receive of B(DW):
– W = W + DW;
– if idle, become active
• Send of C(DW):
– send C(W) to controlling agent
– Become idle
• Receive of C(DW):
– W = W + DW
– if W = 1, declare “termination”