UNIT 4 DC Final Copy
UNIT 4 DC Final Copy
UNIT 4 DC Final Copy
A classical example is that of the commit decision in database systems, wherein the
processes collectively decide whether to commit or abort a transaction that they
participate in.
• Failure models Among the n processes in the system, at most f processes can be
faulty. A faulty process can behave in any manner allowed by the failure model
assumed. The various failure models – fail-stop, send omission and receive omission,
and Byzantine failures.
• In a synchronous system, however, the scenario in which a message has not been
sent can be recognized by the intended recipient, at the end of the round.
• Network connectivity The system has full logical connectivity, i.e., each
process can communicate with any other by direct message passing.
• Channel reliability The channels are reliable, and only the processes may fail
(under one of various failure models).
• (i) it can forge the message and claim that it was received from another process,
and
• (ii) it can also tamper with the contents of a received message before relaying it.
When a process receives a message, it has no way to verify its authenticity.
The Byzantine agreement problem requires a designated process, called the source
process, with an initial value
Problem definition agreement with the other processes about its initial value, subject
to the following conditions:
• Validity If the source process is non-faulty, then the agreed upon value by all the non-
faulty processes must be the same as the initial value of the source.
• Termination Each non-faulty process must eventually decide on a value. The validity
condition rules out trivial solutions, such as one in which the agreed upon value is a
constant.
The consensus problem
The consensus problem differs from the Byzantine agreement problem in that each
process has an initial value and all the correct processes must agree on a single value
• Agreement All non-faulty processes must agree on the same (single) value.
• Validity If all the non-faulty processes have the same initial value, then the agreed
upon value by all the non-faulty processes must be that same value.
The interactive consistency problem differs from the Byzantine agreement problem in
that each process has an initial value, and all the correct processes must agree upon a
set of values, with one value for each process.
• Agreement All non-faulty processes must agree on the same array of values
A[v1…vn]
• Validity If process i is non-faulty and its initial value is vi, then all nonfaulty
processes agree on vi as the ith element of the array A. If process j is faulty, then the
non-faulty processes can agree on any value for A[j].
A distributed mechanism would have each process broadcast its values to others,
and each process computes the same function on the values received.
Algorithms to collect the initial values and then distribute the decision may be
based on the token circulation on a logical ring, or the three phase
• Here the consensus variable x is integer value; each process has initial value xi.
• So, of all the values received within that round and its own value xi at that start
of the round the process takes minimum and updates xi occur f + 1 rounds the
local value xi guaranteed to be the consensus value.
• So, this will complete one round in this one round and this particular process on
receiving 1 it will send 1 over here and this on the receiving 0 it will send 0 over
here.
The agreement condition is satisfied because in the f+1 rounds ,there must be atleast
one round in which no process failed.
• In this round, say round r,all the processes that have not failed so far succeed in
broadcasting their values, and all these processes take the minimum of the values
broadcast and received in that round.
• Thus,the local values at the end of the round are the same,say x ri for all non-failed
processes.
• In further rounds,only this value maybe sent by each process atmost once,and no
process I will update its value x ri.
• The validity condition is satisfied because processes do not send fictitious values in
this failure model.
• For all i,if the initialvalue is identical,then the only value sent by any process is the
value that has been agreed upon as per the agreement condition.
• 2 in 2nd round, the "Phase king" process arrives at an estimate based on the
values it received in 1st round, and broadcasts its new estimate to all others.
Fig. Message pattern for the phase -king algorithm.
(f + 1) phases, (f + 1)[( n - 1)( n + 1)] messages, and can tolerate up to f < dn=4e
malicious processes
Correctness Argument
In all 3 cases, argue that Pi and Pj end up with same value as estimate
• If all non-malicious processes have the value x at the start of a phase, they will
continue to have x as the consensus value at the end of the phase.
• Rollback recovery protocols restore the system back to a consistent state after a failure,
• It achieves fault tolerance by periodically saving the state of a process during the
failure- free execution
• It treats a distributed system application as a collection of processes that communicate
over a network Checkpoints
The saved state is called a checkpoint, and the procedure of restarting from a
previously check pointed state is called rollback recovery.
A checkpoint can be saved on either the stable storage or the volatile storage
Rollback propagation
The dependencies among messages may force some of the processes that did not fail
to roll back. This phenomenon of cascaded rollback is called the domino effect.
Uncoordinated check pointing
If each process takes its checkpoints independently, then the system cannot avoid the
domino effect – this scheme is called independent or uncoordinated check pointing
Techniques that avoid domino effect
1. Coordinated check pointing rollback recovery - Processes coordinate their checkpoints
to form a system-wide consistent state
2. Communication-induced check pointing rollback recovery - Forces each process to
take checkpoints based on information piggybacked on the application.
3. Log-based rollback recovery - Combines check pointing with logging of non-
deterministic events
• relies on piecewise deterministic (PWD) assumption.
Background and definitions
System model
• A distributed system consists of a fixed number of processes, P1, P2,…_ PN , which
communicate only through messages.
•
Processes cooperate to execute a distributed application and interact with the outside
world by receiving and sending input and output messages, respectively
• Some protocols assume that the communication uses first-in-first-out (FIFO) order,
while other protocols assume that the communication subsystem can lose, duplicate,
or reorder messages
–if a process‟s state reflects a message receipt, then the state of the
corresponding sender must reflect the sending of the message
• The state in Figure (a) is consistent because it represents a situation in which every
message that has been received, there is a corresponding message send event.
• The state in Figure (b) is inconsistent because process P2 is shown to have received m2
but the state of process P1 does not reflect having sent it.
A common approach is to save each input message on the stable storage before
allowing the application program to process it.
An interaction with the outside world to deliver the outcome of a computation is
shown on the process-line by the symbol “||”.
1. In-transit message
• messages that have been sent but not yet received
2. Lost messages
3. Delayed messages
• messages whose “receive‟ is not recorded because the receiving process was
either down or themessage arrived after rollback
4. Orphan messages
• messages with “receive‟ recorded but message“send‟ not recorded
• do not arise if processes roll back to a consistent global state
5. Duplicate messages
• arise due to message logging and replaying during process recovery
In-transit messages
In Figure , the global state {C1,8 , C2, 9 , C3,8,C4,8} shows that messagem1 has been sent but
not yet received. We call such a message anin-transit message. Messagem2 is also an in-transit
message.
Delayed messages
Messages whose receive is not recorded because the receiving process was either down or the
message arrived after the rollback of the receiving process, are calleddelayed messages. For
example, messages m2 and m5 inFigure are delayed messages.
Lost messages
Messages whose send is not undone but receive is undone due to rollback are called
lost messages. This type of messages occurs when the process rolls back to a
checkpoint prior to reception of the message while the sender does not rollback
beyond the send operation of the message.
Duplicate messages
• Duplicate messages arise due to message logging and replaying during process
recovery. For example, in Figure, message m4 was sent and received before the
rollback.
• However, due to the rollback of process P4 to C4,8 and process P3 to C3,8, both send
and receipt of message m4 are undone.
• When process P3 restarts from C3,8, it will resend message m4.
• Therefore, P4 should not replay message m4 from its log.
• If P4 replays message m4, then message m4 is called a duplicate message.
• The computation comprises of three processes Pi, Pj , and Pk, connected through a
communication network. The processes communicate solely by exchanging messages
over fault free, FIFO communication channels.
• Processes Pi, Pj , and Pk, have taken checkpoints {Ci,0, Ci,1}, {Cj,0, Cj,1, Cj,2}, and
{Ck,0, Ck,1}, respectively, and these processes have exchanged messages A to J
Suppose process Pi fails at the instance indicated in the figure. All the contents of the
volatile memory of Pi are lost and, after Pi has recovered from the failure, the system
needs to be restored to a consistent global state from where the processes can resume
their execution.
• Process Pi’s state is restored to a valid state by rolling it back to its most recent
checkpoint Ci,1.
To restore the system to a consistent state, the process Pj rolls back to checkpoint
Cj,1 because the rollback of process Pi to checkpoint Ci,1 created an orphan message
H (the receive event of H is recorded at process Pj while the send event of H has
been undone at process Pi).
• Pj does not roll back to checkpoint Cj,2 but to checkpoint Cj,1. An orphan message
I is created due to the roll back of process Pj to checkpoint Cj,1.
• The delayed message C has several possibilities: C might arrive at process Pi before it
recovers, it might arrive while Pi is recovering, or it might arrive after Pi has
completed recovery. Each of these cases must be dealt with correctly.
• Message D is a lost message since the send event for D is recorded in the restored state
for process Pj , but the receive event has been undone at process Pi. Process Pj will
not resend D without an additional mechanism.
• Messages E and F are delayed orphan messages and pose perhaps the most serious
problem of all the messages. When messages E and F arrive at their respective
destinations, they must be discarded since their send events have been undone.
• Processes, after resuming execution from their checkpoints, will generate both of these
messages.
• Lost messages like D can be handled by having processes keep a message log of all the
sent messages.
• So when a process restores to a checkpoint, it replays the messages from its log to
handle the lost message problem.
Checkpoint-based recovery
Checkpoint-based rollback-recovery techniques can be classified into three categories:
1. Uncoordinated checkpointing
2. Coordinated checkpointing
3. Communication-induced checkpointing
1.Uncoordinated Checkpointing
• Each process has autonomy in deciding when to take checkpoints
• Advantages
The lower runtime overhead during normal execution
• Disadvantages
1. Domino effect during a recovery
2. Recovery from a failure is slow because processes need to iterate to find a consistent
set of checkpoints
• When 𝑃𝑗 receives a message m during 𝐼𝑗,𝑦, it records the dependency from 𝐼𝑖,𝑥 to
𝐼𝑗,𝑦, which is later saved onto stable storage when 𝑃𝑗 takes 𝐶𝑗,𝑦
• When a failure occurs, the recovering process initiates rollback by broadcasting a
dependency request message to collect all the dependency information maintained by
each process.
• When a process receives this message, it stops its execution and replies with the
dependency information saved on the stable storage as well as with the dependency
information, if any, which is associated with its current state.
• The initiator then calculates the recovery line based on the global dependency
information and broadcasts a rollback request message containing the recovery line.
• Upon receiving this message, a process whose current state belongs to the recovery
line simply resumes execution;
2.Coordinated Checkpointing
In coordinated checkpointing, processes orchestrate their checkpointing activities so
that all local checkpoints form a consistent global state
Types
1. Blocking Checkpointing:
After a process takes a local checkpoint, to prevent orphan messages, it remains
blocked until the entire check pointing activity is complete
Disadvantages: The computation is blocked during the check pointing
2. Non-blocking Checkpointing:
The processes need not stop their execution while taking checkpoints. A
fundamental problem in coordinated checkpointing is to prevent a process from
receiving application messages that could make the checkpoint inconsistent.
Example (a) : Checkpoint inconsistency
• Message m is sent by 𝑃0 after receiving a checkpoint request from the checkpoint
Algorithm
• The algorithm consists of two phases. During the first phase, the checkpoint initiator
identifies all processes with which it has communicated since the last checkpoint and
sends them a request.
• Upon receiving the request, each process in turn identifies all processes it has
communicated with since the last checkpoint and sends them a request, and so on,
until no more processes can be identified.
• During the second phase, all processes identified in the first phase take a checkpoint.
The result is a consistent checkpoint that involves only the participating processes.
• In this protocol, after a process takes a checkpoint, it cannot send any message until the
second phase terminates successfully, although receiving a message after the
checkpoint has been taken is allowable.
3.Communication-induced Checkpointing
Communication-induced checkpointing is another way to avoid the domino
effect, while allowing processes to take some of their checkpoints independently.
Processes may be forced to take additional checkpoints
• The forced checkpoint must be taken before the application may process the contents
of the message.
Model-based checkpointing
• Model-based checkpointing prevents patterns of communications and checkpoints that
could result in inconsistent states among the existing checkpoints.
• No control messages are exchanged among the processes during normal operation. All
information necessary to execute the protocol is piggybacked on application messages
• The MRS (mark, send, and receive) model of Russell avoids the domino effect by
ensuring that within every checkpoint interval all message receiving events precede
all message-sending events.
Index-based checkpointing.
• Index-based communication-induced checkpointing assigns monotonically increasing
indexes to checkpoints, such that the checkpoints having the same index at different
processes form a consistent state.
• Koo and Toueg coordinated check pointing and recovery technique takes a consistent
set of checkpoints and avoids the domino effect and livelock problems during the
recovery.
• Includes 2 parts: the check pointing algorithm and the recovery algorithm
3. If Pi learns that all processes are willing to restart from their previous checkpoints, Pi
decides that all processes should roll back to their previous checkpoints. Otherwise,
4. Pi aborts the roll back attempt and it may attempt a recovery at a later time.
Second Phase
1. Pi propagates its decision to all the processes.
2. On receiving Pi’s decision, a process acts accordingly
The message transmission delay is arbitrary, but finite
The following notations and data structure are used by the algorithm:
• RCVDi←j(CkPti) represents the number of messages received by processor pi
from processor pj , from the beginning of the computation till the checkpoint CkPti.
• The recovery algorithm achieves this by making each processor keep track of both the
number of messages it has sent to other processors as well as the number of messages
it has received from other processors.
• Whenever a processor rolls back, it is necessary for all other processors to find out if
any message has become an orphan message.
•
• Orphan messages are discovered by comparing the number of messages sent to and
received from neighbouring processors.
CkPti := latest event that took place in pi {The latest event at pi can be either in stable
or in volatile storage.} end if
STEP (b)
for k = 1 1 to N {N is the number of processors in the system} do
for each neighboring processor pj do
compute SENTi→j(CkPti)
• Initially, X, Y, and Z set CkPtX ← ex3, CkPtY ← ey2 and CkPtZ ← ez2, respectively,
and X, Y, and Z send the following messages during the first iteration:
2 MARKS:
Each process has an initial value and all the correct processes must agree
on a single
value.
The difference between the agreement problem and the consensus problem is
that, in the agreement problem, a single process has the initial value, whereas in the
consensus problem, all processes have an initial value.
6. Define recovery.
Shadow version uses a map to locate versions of the server's objects in a file
called a version store. The map associates the identifiers of the server's objects
with the positions of their current versions in the version store. The versions
written by each transaction are shadows of the previous committed versions. The
transaction status entries and intentions lists are stored separately. When a
transaction commits, a new map is made by copying the old map and entering the
positions of the shadow versions. To complete the commit process, the new map
replaces the old map.
10. Define fault and failure. What are different approaches to fault-tolerance?
Failure of a system occurs when the system does not perform its service in
the manner specified.
1. Termination
2. Agreement and
3. Integrity.
12. What are the performance aspects of agreement
algorithms
A process may take a local check point anytime during the execution. The
local checkpoints of different processes are not coordinated to form a global
consistent checkpoint.
Messages with receive recorded but message send not recorded are called the
orphan messages.
20. What is the basic idea behind task assignment
b. The amount of computation required by each task and the are known.
13 MARKS:
Impossible Scenario
Lamport – Shostak – Pease Algorithm
o Example
Definition
o Strongly Consistent Set of Checkpoint.
o Consistent Set of Checkpoint
o Checkpoint Notation
Synchronous Checkpoint and Recovery
o Checkpointing Algorithm
Types
o Synchronous Checkpointing Disadvantages
The Rollback Recovery Algorithm
o Phase one
o Phase two
Message Types
Uncoordinated Checkpointing
o Direct dependency tracking technique
Coordinated Checkpointing
o Blocking Checkpointing
o Non – Blocking Checkpointing
Communication – induced Checkpointing
4. Describe the Issues in Failure Recovery.
Basic Concept
Recovery
o System Failure
o Erroneous System State
o Error
o Fault
Introduction
o The Problem
o Validity
Consensus Problem
o Agreement
o Validity
Interactive Consistency Problem