LM10
LM10
OUTCOMES:
Upon the completion of this course, the student will be able to
CO1: Explain the foundations of distributed systems (K2)
CO2: Solve synchronization and state consistency problems (K3)
CO3 Use resource sharing techniques in distributed systems (K3)
CO4: Apply working model of consensus and reliability of distributed systems (K3)
CO5: Explain the fundamentals of cloud computing (K2)
Physical Clock?
Logical Clock
Lamport Logical clock
Lamport Logical clock
Lamport Logical clock
Lamport Logical clock
SCALAR TIME
There are different methods for implementing logical clocks in a distributed system, but one
of the simplest is Scalar Time.
Scalar time is designed by Lamport to synchronize all the events in distributed systems.
This logical clock has meaning only in relation to messages moving between processes.
When a process receives a message, it resynchronizes its logical clock with that sender
maintaining causal relationship.
In this implementation, each process keeps a local clock that is initially set to 0.
2. Total Reordering- Scalar clocks order the events in distributed systems. The main
problem in totally ordering events is that two or more events at different processes may
have an identical timestamp. Hence a tie breaking mechanism is essential to order the
events.
The tie breaking is done through:
i)Process identifiers are linearly ordered.
ii)The lower the process identifier in the ranking, the higher the priority.
The timestamp of an event is denoted by a tuple (t, i) where t is its time of occurrence
and i is the identity of the process where it occurred.
SCALAR TIME
3. Event counting - 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. This
is called height of the event e.
4. No strong consistency- The scalar clocks are not strongly consistent that is the
logical local clock and logical global clock of a process are squashed into one, resulting
in the loss causal dependency information among events at different processes.
Limitations of Lamport’s Clock
Limitations of Lamport’s Clock
Vector Time is an algorithm that generates partial ordering of events and detects
causality violations in a distributed system.
These clocks expand on Scalar time to facilitate a causally consistent view of the
distributed system, they detect whether a contributed event has caused another
event in the distributed system.
This algorithm helps us label every process with a vector(a list of integers) with an
integer for each local clock of every process within the system. So for N given
processes, there will be vector/ array of size N.
VECTOR TIME
VECTOR TIME
VECTOR TIME
Every time, an Internal event occurs in a process, the value of the processes’s logical
clock in the vector is incremented by 1
Also, every time a process sends a message, the value of the processes’s logical
clock in the vector is incremented by 1.
Every time, a process receives a message, the value of the processes’s logical clock
in the vector is incremented by 1, and moreover, each element is updated by taking
the maximum of the value in its own vector clock and the value in the vector in the
received message (for every element).
VECTOR TIME
VECTOR TIME
VECTOR TIME
VECTOR TIME –calculate clock time of e11
VECTOR TIME –calculate clock time of e12
VECTOR TIME –calculate clock time of e21
VECTOR TIME –calculate clock time of e22
VECTOR TIME –calculate clock time of e23=> calc e31 first
VECTOR TIME –calculate clock time of e23
VECTOR TIME –calculate clock time of e24
VECTOR TIME –calculate clock time of e13
VECTOR TIME –calculate clock time of e32
VECTOR TIME
Example : Consider a process (P) with a vector size N for each process: the above set of rules
mentioned are to be executed by the vector clock:
VECTOR TIME
The above example depicts the vector clocks mechanism in which the vector
clocks are updated after execution of internal events, the arrows indicate how the
values of vectors are sent in between the processes (P1, P2, P3).
To sum up, Vector clocks algorithms are used in distributed systems to provide
a causally consistent ordering of events but the entire Vector is sent to each
process for every message sent, in order to keep the vector clocks in sync.
VECTOR TIME
1.Isomorphism -
If events in a distributed system are timestamped using a system of vector clocks,
we have the following property.
2. Strong consistency –
The system of vector clocks is strongly consistent; thus, by examining the vector
timestamp of two events, we can determine if the events are causally related.
VECTOR TIME
3. Event Counting –
If d=1 (in rule R1), then the ith component of vector clock at process pi , vti[i],
denotes the number of events that have occurred at pi until that instant.