Question Answer Bank _Module II
Question Answer Bank _Module II
Module - II
Part A
1. Define Logical Clock.
Intuitively, this relation is analogous to the earlier than relation provided by the
physical time.
TRACE KTU
2. Define Scalar time. / Explain the rules used to update clocks in scalar time
representation.
TRACE KTU
3. What are the basic properties of scalar time?
Basic properties
1. Consistency property
2. Total Ordering
The main problem in totally ordering events is that two or more events at
different processes may have an identical timestamp.
a tie-breaking mechanism is needed to order such events
a tie is broken as follows:
process identifiers are linearly ordered and a tie among events with
identical scalar timestamp is broken on the basis of their process
identifiers.
The lower the process identifier in the ranking, the higher the priority.
3. Event counting
4. No strong consistency
The system of scalar clocks is not strongly consistent; that is, for two events e i
and ej
TRACE KTU
5. Define Vector Time.
A vector clock is a data structure used for determining the partial ordering
of events in a distributed system and detecting causality violations
Basic properties
1. Isomorphism
relation “→” induces a partial order on the set of events that are produced by a
distributed execution.
3. Event counting
Applications
distributed debugging,
We say that a process calls the election if it takes an action that initiates a
particular run of the election algorithm.
TRACE KTU
All processes take their local snapshots at that instant in the global time.
TRACE KTU
Part B
1. Discus the implementation of logical Clock
A system of logical clocks consists of a time domain T and a logical clock C .
Elements of T form a partially ordered set over a relation <
Intuitively, this relation is analogous to the earlier than relation provided by the
physical time.
TRACE KTU
Each process p i has a communication channel to the next process in the ring, p
( i + 1) mod N ,
all messages are sent clockwise around the ring.
The goal of this algorithm is to elect a single process called the coordinator,
TRACE KTU
If, however, the received identifier is that of the receiver itself, then this
process’s identifier must be the greatest, and it becomes the coordinator.
TRACE KTU
new leader. Does the algorithm meet liveness and safety conditions?
The process that knows it has the highest identifier can elect itself as the
coordinator simply by sending a coordinator message to all processes
with lower identifiers.
On the other hand, a process with a lower identifier can begin an election
by sending an election message to those processes that have a higher
identifier and awaiting answer messages in response.
If none arrives within time T, the process considers itself the coordinator
and sends a coordinator message to all processes with lower identifiers
announcing this.
TRACE KTU
P’ s job is done. When a process gets an ELECTION message from one
of its lower-numbered colleagues:
● Eventually, all processes give up but one, and that one is the new
coordinator.
● It holds an election.
● Biggest guy” always wins and hence the name “ bully” algorithm.
4. In a ring topology 7 processes are connected with different ID’s as
TRACE KTU
shown: P20->P5->P10->P18->P3->P16->P9 If process P10 initiates election
after how many message passes will the coordinator be elected and known
to all the processes. What modification will take place to the election
message as it passes through all the processes? Calculate total number of
election messages and coordinator messages
TRACE KTU
5. Pid’s 0,4,2,1,5,6,3,7, P7 was the initial coordinator and crashed, Illustrate
Bully algorithm, if P4 initiates election , Calculate total number of election
messages and coordinator messages
6. Explain in detail about Global state and snapshot recording algorithms.
TRACE KTU
clock in a distributed system, added to the fact that message transfer
delays in these systems are finite but unpredictable, makes this problem
non-trivial.
System model
The system consists of a collection of n processes, p1, p2, , pn, that are
connected by channels.
TRACE KTU
There is no globally shared memory and processes communicate solely
by passing messages.
Messages are delivered reliably with finite but arbitrary time delay.
System model
For a message mij that is sent by process pi to process pj, let send(mij)
and rec(mij) denote its send and receive events, respectively.
For example, an internal event changes the state of the process at which it
occurs.
A send event (or a receive event) changes the state of the process that
sends (or receives) the message and the state of the channel on which the
message is sent (or received).
At any instant, the state of process pi, denoted by LSi, is a result of the
sequence of all the events executed by pi up to that instant
TRACE KTU
A consistent global state
The global state of a distributed system is a collection of the local states of the
processes and the channels. Notationally, global state GS is defined as
A cut is a line joining an arbitrary point on each process line that slices
the space–time diagram into a PAST and a FUTURE.
All the messages that cross the cut from the PAST to the FUTURE are
captured in the corresponding channel state.
TRACE KTU
Chandy–Lamport algorithm
After a site has recorded its snapshot, it sends a marker along all of its outgoing
TRACE KTU
channels before sending out any more messages.
Since channels are FIFO, a marker separates the messages in the channel into
those to be included in the snapshot (i.e., channel state or process state) from
those not to be recorded in the snapshot.
The algorithm
If the process has not yet recorded its local state, it records the state of the
channel on which the marker is received as empty and executes the marker
sending rule to record its local state Otherwise, the state of the incoming
channel on which the marker is received is recorded
The algorithm can be initiated by any process by executing the marker sending
rule.
The algorithm terminates after each process has received a marker on all of its
incoming channels.
The recorded local snapshots can be put together to create the global snapshot
TRACE KTU
8. Explain Termination detection using distributed snapshots. / Clearly
mentioning assumptions, explain the rules of termination detection using distributed snapshots.
When a process goes from active to idle, it issues a request to all other
processes to take a local snapshot, and also requests itself to take a local
snapshot.
When a process receives the request, if it agrees that the requester became
idle before itself, it grants the request by taking a local snapshot for the
request.
The requester or any external agent may collect all the local snapshots of
a request.
TRACE KTU
obtained and the recorded state will indicate termination of the
computation, viz.,
in the recorded snapshot, all the processes are idle and there is no
message in transit to any of the processes
The computation starts when the controlling agent sends a basic message
to one of the processes.
Thus, the sum of weights on all the processes and on all the messages in
transit is always 1.
TRACE KTU
The controlling agent concludes termination if its weight becomes 1.
TRACE KTU
10.Discuss in Detail about spanning-tree-based termination
detection algorithm / illustrate the working of spanning tree based termination
detection algorithm
TRACE KTU
signals moving inward and outward through the spanning tree.
Initially, a contracting wave of signals, called tokens, moves
inward from leaves to the root.
If this token wave reaches the root without discovering that
termination has occurred, the root initiates a second outward
wave of repeat signals.
As this repeat wave reaches leaves, the token wave gradually
forms and starts moving inward again.
This sequence of events is repeated until the termination is
detected
•
Initially, each leaf process is given a token.
• Each leaf process, after it has terminated, sends its token to its
parent.
•
TRACE KTU
When a parent process terminates and after it has received a
token from each of its children, it sends a token to its parent.
• This way, each process indicates to its parent process that the
subtree below it has become idle.
• In a similar manner, the tokens get propagated to the root.
• The root of the tree concludes that termination has occurred,
after it has become idle and has received a token from each of
its children.
TRACE KTU
TRACE KTU
TRACE KTU
TRACE KTU
TRACE KTU
12. Apply spanning tree-based termination detection algorithm in the following scenario. The
nodes are processes 0 to 6. Leaf nodes 3, 4, 5, and 6 are each given tokens T3, T4, T5 and T6
respectively. Leaf nodes 3, 4, 5 and 6 terminate in the order, but before terminating node 5,it
sends a message to node
TRACE KTU