DC Module 2 .Pptx
DC Module 2 .Pptx
-MODULE 2
•Logical time – A framework for a system of logical clocks, Scalar time, Vector
time.
•Leader election algorithm – Bully algorithm, Ring algorithm.Global state and
snapshot recording algorithms – System model and definitions, Snapshot algorithm
for FIFO channels – Chandy Lamport algorithm.
•Termination detection – System model of a distributed computation, Termination
detection using distributed snapshots, Termination detection by weight throwing,
Spanning-tree-based algorithm.
PREPARED BY SHARIKA T R, AP, SNGCE 8
Logical Time - Introduction
Logical Time - Introduction
The knowledge of the causal precedence relation among the events of
processes helps solve a variety of problems in distributed systems. Examples
of some of these problems is as follows:
● Distributed algorithms design -liveness and fairness in mutual exclusion algorithms, helps
maintain consistency in replicated databases, and helps design correct deadlock detection
algorithms to avoid undetected deadlocks.
● Tracking of dependent events -In distributed debugging, the knowledge of the causal
dependency among events helps construct a consistent state for resuming re-execution; in
failure recovery, it helps build a checkpoint; in replicated databases, it aids in the detection of
file inconsistencies in case of a network partitioning.
● Knowledge about the progress -The knowledge of the causal dependency among events
helps measure the progress of processes in the distributed computation. This is useful in
discarding obsolete information, garbage collection, and termination detection.
● Concurrency measure The knowledge of how many events are causally dependent is useful
in measuring the amount of concurrency in a computation. All events that are not causally
related can be executed concurrently. Thus, an analysis of the causality in a computation
gives an idea of the concurrency in the program.
A framework for a system of logical clocks
13
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 a global time.
20
Scalar time basic Properties
30
PREPARED BY SHARIKA T R, AP, SNGCE 31
Leader election algorithm
•Another reason is that we would not want all the processes to replicate
the algorithm a initiation, to save on resources.
PREPARED BY SHARIKA T R, AP, SNGCE 33
• An algorithm for choosing a unique process to play a particular role
(coordinator) is called an election algorithm.
• An election algorithm is needed for this choice.
• It is essential that all the processes agree on the choice.
• Afterwards, if the process that plays the role of server wishes to retire
then another election is required to choose a replacement.
• We say that a process calls the election if it takes an action that
initiates a particular run of the election algorithm.
• At any point in time, a process Pi is either a participant – meaning that
it is engaged in some run of the election algorithm – or a
34
Elec
20
ted
)
msg(20
m
20
sg (
20)
Elected
18
P10
)
20
g(
P16
dms
cte
Ele 10
Ele
cte
dm
sg
(20
0)
) sg (2 P18 20
ed m
Elect
20
P3
18 18
46
20
39
43
The Bully algorithm – Example
▪ The global state of a distributed system is a collection of the local states of its
components
▪ Recording the global state of a distributed system is an important paradigm and it
finds applications in several aspects of distributed system design
▪ For examples, in detection of stable properties such as deadlocks, and termination
, global state of the system is examined for certain properties;
▪ for failure recovery, a global state of the distributed system (called a checkpoint)
is periodically saved and recovery from a processor failure is done by restoring
the system to the last saved global state
▪ If shared memory were available, an up-to-date state of the entire system would
be available to the processes sharing the memory.
▪ The absence of shared memory necessitates ways of getting a coherent and
complete view of the system based on the local states of individual processes.
Interpretation in terms of cuts