Unit 2 DC
Unit 2 DC
C : H T,
such that the following property is satisfied: for two events ei and ej ,
ei → ej C(ei) < C(ej ). This monotonicity property is called the clock consistency condition.
Implementation of logical clocks requires addressing two issues: data structures local to
every process to represent logical time and a protocol (set of rules) to update the data structures to
ensure the consistency condition.
Each process pi maintains data structures that allow it the following two capabilities:
1. A local logical clock, denoted by lci, that helps process pi measure its own progress.
2. A logical global clock, denoted by gci, that is a representation of process pi’s local view of
the logical global time. It allows this process to assign consistent timestamps to its local
events. Typically, lci is a part of gci.
The protocol ensures that a process’s logical clock, and thus its view of the global time, is
managed consistently. The protocol consists of the following two rules:
1. R1 This rule governs how the local logical clock is updated by a process when it executes
an event (send, receive, or internal).
2. R2 This rule governs how a process updates its global logical clock to update its view of
the global time and global progress. It dictates what information about the logical time is
piggybacked in a message and how this information is used by the receiving process to
update its view of the global time.
Scalar time
Definition:
The scalar time representation was proposed by Lamport in 1978 as an attempt to totally
order events in a distributed system. Time domain in this representation is the set of non-negative
integers. The logical local clock of a process pi and its local view of the global time are squashed
into one integer variable Ci.
Ci :=Ci+d (d > 0)
In general, every time R1 is executed, d can have a different value, and this value
may be application-dependent. However, typically d is kept at 1 because this is able to
identify the time of each event uniquely at a process, while keeping the rate of increase of
d to its lowest level.
2. R2 Each message piggybacks the clock value of its sender at sending time. When
a process pi receives a message with timestamp Cmsg, it executes the following
actions:
1. Ci := max(Ci, Cmsg,);
2. execute R1;
3. deliver the message.
Figure shows the evolution of scalar time with d=1.
Basic properties
Consistency property
Clearly, scalar clocks satisfy the monotonicity and hence the consistency property:
Total Ordering
Scalar clocks can be used to totally order events in a distributed system. The main problem
in totally ordering events is that two or more events at different processes may have an identical
timestamp.
Event counting
If the increment value d is always 1, the scalar time has the following interesting property:
if event e has a timestamp h, then h−1 represents the minimum logical duration, counted in units
of events, required before producing the event e; we call it the height of the event e.
No strong consistency
The system of scalar clocks is not strongly consistent; that is, for two events ei and ej,