Professional Documents
Culture Documents
Expandability
♦ Limitations
Manas Saksena
No Global Clock
P1:A P2:B
time interval
X = Query(P1:A)
$50 Amount = X + Y
$450 $200
♦ What happens when
a counter is sufficient
P1:A P2:B money is in transit?
♦ Time Interval
1
Logical Clocks Logical Clocks
♦ Happened Before Relation → ♦ Associate a Clock Ci with each Process Pi
a → b, if a and b are in the same process, and a ♦ Clock
occurred before b
− IR1: Ci := Ci + d (d > 0)
♦ Concurrent
Pi /a to Pj/b: tm = Ci(a)
if not (a → b) and not (b → a)
if a → b then C(a) < C(b), but IR1: Ci[i] = Ci[i] + d (on local events)
less than
P3: 0,0,0 2,0,1 − less than or equal and not equal
(
concurrent
− both not less than
University of Pittsburgh Manas Saksena 11 University of Pittsburgh Manas Saksena 12
2
Vector Clocks Causal Message Ordering
♦ Causally Related ♦ What?
If send(m1) → send(m2) then
*
Example: Replicas
− ensures replica consistency
send(m1)
send(m2)
Unreliable
3
Distributed Algorithms Model Distributed Algorithms Model
♦ Failures ♦ Lack of Precisely Synchronized Time
: =
D
done by receiver side of channel
Then, the channel state (for a channel from Pi to
G
P1 & P1
♦ Case 2: if receiver state is already recorded
K
♦ Two One-way Point-to-Point Channels
mark channel state as all messages received from M
c & c’
the time it recorded its own state until the receipt
of the marker
University of Pittsburgh Manas Saksena 23 University of Pittsburgh Manas Saksena 24
4
Example: Possible System
Example: Process Behavior
Evolution
♦ Behavior of each process is represented using a finite state machine Event P1 P2 C C’
♦ Process States are represented abstractly (in this example) Initial A C - -
♦ Channel states are the messages in transit on the channel
e1: Send M B C M -
event state e2: Send M’ B D M M’
Send msg M on C Send msg M’ on C’ e3: Recv M’ A D M -
A B C D
♦ Three events: e1, e2, e3
N
recv msg M’ on C’ recv msg M on C assume that they occurred in this order
♦ Each row is a global state of the system
transition ♦ The table shows the evolution of the system
Process P1 Process P2 ♦ Note: we know that e2 must occur before e3 (e2→e3)
Example
Process P1 Process P2
♦ Record State (as A) ♦ Send M’ (e2)
♦ Send Marker on C ♦ Receive Marker on C
♦ Send M (e1) ♦ Record own state (as D)
♦ Receive M’ (e3) ♦ Record C state (as -)
♦ Receive Marker on C’ ♦ Send Marker on C’
♦ Record C’ state (as M’)
♦ Final Recorded State: P1 (A), P2 (D), C (-), C’ (M’)
♦ Note: this corresponds to event sequence: e2, e1, e3
− possible & consistent sequence, but may not have happened