1.31k likes | 1.48k Views
Causality. The “happens before” relation. happens before (causes). A message is sent from to. transitivity. and. “happens before” is a partial order. Parallel events:. “happens before” is a partial order. Parallel events:. We can move parallel events.
E N D
The “happens before” relation happens before (causes)
transitivity and
“happens before” is a partial order Parallel events:
“happens before” is a partial order Parallel events:
We can move parallel events The happens before relation doesn’t change
We want to find a mechanism that captures the “happens before” relationship so that we use causality in various computation problems
Logical Clocks 0 1 2 3 4 5 0 2 3 4 1 In each process, the logical clock increases by 1 with each local event
Logical clocks are piggy-packed on messages 0 1 2 5 4 0 1 2 3 4
1 2 3 7 8 2 4 5 6 1 2 3 4 5 6 7 Logical clocks, seem that they capture the happens before relation
1 2 3 7 8 2 4 5 6 1 2 3 4 5 6 7 Example:
1 2 3 7 8 2 4 5 6 1 2 3 4 5 6 7 However, logical clocks cannot capture parallelism Parallel events
We need another mechanism that can capture the parallelism of events
Vector Clocks Process entry Process entry
vector clocks are piggy-packed on messages The maximum of each entry
Comparison of vector clocks We write if for all
Incomparable vector clocks We write If neither nor
Vector clocks capture causality If then If then
By examining the vector clocks we can determine the order of events If then If then
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 Cut: consists from an event from each process
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 no messages cross the cut Consistent cut:
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 messages can cross from left to right of the cut Consistent cut:
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 messages cross from right to left of the cut Inconsistent cut:
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 messages cross from right to left of the cut Inconsistent cut:
Maximal Consistent Cut Consider some (inconsistent) cut Maximal Consistent Cut of : A consistent cut such that and contains most recent events
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 (inconsistent cut)
2 1 3 4 5 1 2 3 4 1 2 3 4 5 6 7 maximal consistent cut (inconsistent cut)
Theorem: For every cut , there is a unique maximal consistent cut Proof: Proof by contradiction
Assume for contradiction there are two (or more) maximal cuts of maximal consistent cuts
It cannot be that and don’t cross not maximal!
and cross new cut
and cross impossible since is consistent
and cross impossible since is consistent
and cross Contradiction! not maximal! not maximal! is consistent End of proof