Distributed Computing: Lecture 3 Coordination in Distributed Systems Logical Clocks
Distributed Computing: Lecture 3 Coordination in Distributed Systems Logical Clocks
a, b are concurrent
c
p1
c happens after a, b
b
p2
What can you say about a and b?
d
p3
• a c, b c, c d d happens after a, b, c
Examples • hence, a d, b d
• a, b are concurrent
Illustration of logical timestamps
Example
C(a)=1 C(d)=2
p0
a d
e C(f)=5
p1 f
C(e)=3
p2 C(b)=1
b
C(g)=6
C(c)=1
p3
c g
Example: Total-ordered multicast
Concurrent updates on a replicated database are seen in the same order
everywhere
P1 adds $100 to an account (initial value: $1000)
P2 increments account by 1%
There are two replicas
Update 1 Update 2
Replicated database
Update 1 is Update 2 is
performed before performed before
update 2 update 1
Result
In absence of proper synchronization:
replica #1 ← $1111, while replica #2 ← $1110.
Example: Total-ordered multicast
Vector timestamps