6. [12 pts] Logical clocks and happen-before relations
Suppose you observed the events a, b, c,... in 3 processes as shown the below figure.
P1
a
b
m1
P2
P3
e
d
Physical
time
M2
f
The local logical clocks without any adjustments.
Give the logical clocks with adjustments.
P1
P2
P3
0
0
0
12 a
4
2
P1
0
12
P2
a
0
4
24
b
8
4
c
b
P3
0
2
c
36
12
6
48
16
c
8
60
20
d
10
72
24
12
f
d
f
84
28
14
a. How would you tag these events and adjust logical clocks according to
Lamport's clock in the above figures?
b. Lamport's logical clock mainly uses the "happens-before relation (-->)" to
adjust the logical clocks, as you did in part (a). You are now asked to
formally define "happens-before relation (-->)"
c. After your adjustments in part (a) and definitions in part (b), what can be
said about the following pairs of events (are they (or not) related by
happens-before relation (-->), why or why not):
(a, b)
(a, c)
(a, e)
(c, e)
d. Using vector clocks, it is now possible to ensure that a message is delivered
only if all messages that causally precede it have also been received as well.
Use an example to explain how vector clocks are used to achieve causally
ordered events.