Module3 Notes
Module3 Notes
SYSTEM(BCS515D)
MODULE-3 NOTES
INTRODUCTION
• Time is an important and interesting issue in distributed
systems, for several reasons.
• First, time is a quantity we often want to measure accurately. In
order to know at what time of day a particular event occurred at
a particular computer it is necessary to synchronize its clock with
an authoritative, external source of time.
• Second, algorithms that depend upon clock synchronization
have been developed for several problems in distribution.
• These include
o maintaining the consistency of distributed data
o checking the authenticity of a request sent to a server
o eliminating the processing of duplicate updates
• In the first half of this chapter, we examine methods whereby
computer clocks can be approximately synchronized, using
message passing. We go on to introduce logical clocks, including
vector clocks, which are used to define an order of events
without measuring the physical time at which they occurred.
• In the second half, we describe algorithms whose purpose is to
capture global states of distributed systems as they execute.
and:
o = oi + (t’– t) / 2 = , where oi = (Ti – 2 – Ti – 3 + Ti – 1 – Ti )/ 2
• Logical clocks
o Lamport [1978] invented a simple mechanism by which the
happened before ordering can be captured numerically,
called a logical clock.
o A Lamport logical clock is a monotonically increasing
software counter, whose value need bear no particular
relationship to any physical clock.
o Each process pi keeps its own logical clock, Li , which it uses
to apply so-called Lamport timestamps to events. We denote
the timestamp of event e at pi by Li(e) , and by L(e) we denote
the timestamp of event e at whatever process it occurred at.
o To capture the happened-before relation , processes update
their logical clocks and transmit the values of their logical
clocks in messages as follows:
LC1:
Li is incremented before each event is issued at process pi
Li := Li + 1.
LC2:
(a) When a process pi sends a message m, it piggybacks
on m the value
t = Li
Page 10 of 12
• VECTOR CLOCKS
o Mattern [1989] and Fidge [1991] developed vector clocks
to overcome the shortcoming of Lamport’s clocks: the fact
that from L(e) < L(e’) we cannot conclude that e -> e’.
o A vector clock for a system of N processes is an array of N
integers. Each process keeps its own vector clock, Vi , which
it uses to timestamp local events.
o Like Lamport timestamps, processes piggyback vector
timestamps on the messages they send to one another, and
there are simple rules for updating the clocks:
Page 11 of 12