0% found this document useful (0 votes)
9 views9 pages

0 - Chap-8 Agreement Protocols

Uploaded by

pramodpj746
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views9 pages

0 - Chap-8 Agreement Protocols

Uploaded by

pramodpj746
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Agreement Protocols

• Examples
– Agreeing whether to commit or to abort a transaction in a
distributed database management system.
– Agreeing on a common clock value in a distributed system.
• In the absence of failures or faulty processors, values
(that is to be decided) can be exchanged. A vote can
be taken and decision/agreement can be made
based on: majority, minimum vote, mean, etc.
• Presence of failure: processors can fail or misbehave
intentionally. Several rounds of message exchanges
might be needed before agreement can be reached.

1
Types of Agreement Problems
• Byzantine Agreement Problem
– A single value is to be agreed upon.
– Initial value to be proposed by an arbitrary processor: all non-
faulty processors need to agree on that value.
• Consensus Problem
– Every processor has its own initial value.
– All non-faulty processors agree on a common value.
• Interactive Consistency Problem
– Every processor has its own initial value.
– All non-faulty processors agree on aset of common values (or)
a vector.
Above three types are closely related. Byzantine agreement
problem forms the basis of other 2 types. We focus on
Byzantine agreement.

2
Byzantine Agreement Problem
• An arbitrary source processor broadcasts its initial
value to all others.
• If the source processor is faulty, other non-faulty
processor can agree onany common value.
• Faulty processors’ values and agreements do not
matter.
• If faulty processors are in majority, then non-faulty
processors cannot reach an agreement.
• Number of faulty processors, m , cannot exceed:
trunc[(n-1)/3].
• This bound can be relaxed for systems using
authenticated messages.

3
Impossible Scenario
• Consider a system with 3 processors: p0, p1, p2.
• Two possibilities:
– Case 1: p0 (source) is not faulty. p2 is faulty. p1 should agree
upon 1 as the value. Not possible.
– Case 2: p0 is faulty. p1 may agree on 1 and p2 on 0.

Case 1: Case 2:

p0 p2
1 1 1 1
1 0
p1 p2 p1 p0
0 0

4
Lamport’s Algorithm
• Referred to as Oral Message Algorithm: OM(m), m > 0.
• For 3m + 1 or more processors of which m are faulty.
• Recursive Algorithm:
– Algorithm OM(0)
• Source processor sends its value to every processor.
• Each processor uses the value it receives from source. (If no value
received, default value of 0 assumed).
– Algorithm OM(m), m > 0
• Source processor sends its value to every processor.
• For each processor, letvi be the value received by processori
(from the source). Processor i acts as new source. Initiates
OM(m-1). Sends vi to each of othern-2 processors.
• Letvj be the value received byPi fromPj in above step. (If no value
received,vj is assumed to be 0).Pi uses majorityv1,
( v2, ..vn-1 ).

5
Lamport’s Algorithm ...
• Processors are successively divided into smaller
groups in step 2 where OM(m-1) is executed.
• Step 3 is executed during the folding phases of
recursion where amajority function selects the
agreed value (among those received in step 2).
• Note:majority returns 0 if one does not exist.
• Number of messages:
– OM(m) : n- 1 executions of OM(m-1)
– OM(m-1): n-2 executions of OM(m-2)....
– (n-1)(n-2)(n-3)... (n-k) executions of OM(m-k), k = 1,2,3,...,
m+1.
– Message complexity: O(n power m).

6
Lamport’s Algorithm: Example
1
• System with 4 processors: p0, p1, p2, p3. p0 is source, p2 is
faulty.
• Assumption: possible values are only 1 and 0.
• Step 1: p0 initiates the initial value to be 1. (Algorithm OM(1), m
=1).
• Step 2: OM(0). p1 sends 1 to {p2, p3}. p3 sends 1 to {p1,p2}
• p2 (the faulty one) sends 1 to p1 and 0 to p3.
• Step 3: majority function at p1 and p3 is 1, which is the desired
result. (Not bothered about p2, the faulty one).
p0 p0
1 1 1 1
1 1
1 0
p1 p2 p3 p1 p2 p3
1 1
1
1
7
Lamport’s Algorithm: Example
2
• System with 4 processors: p0, p1, p2, p3. p0 is source, and is
faulty.
• Assumption: possible values are only 1 and 0.
• Step 1: p0 initiates the initial value to be 1 for p1 and p3. For p2,
it sends a 0(Algorithm OM(1), m =1).
• Step 2: OM(0). p1 sends 1 to {p2, p3}. p3 sends 1 to {p1,p2}
• p2 sends 0 to p1 and p3.
• Step 3: majority function at p1, p2, p3 is still the same (1), which
is the desired result.
p0
1 1
0
1 0
p1 p2 p3
0 1
1

1
8
, Algorithm of Dolev et.al.
(Agreement Protocol)
1. [Initiation] HIGH := 2m + 1, LOW := m + 1 and k := 1. Source
broadcasts value, say “ * ”.
2. [Update] Set k := k + 1. Pj
br
oa
d
c
a
st
s
na
me
so
fn
ew
p
r
oc
es
s
o
r
sf
o
r
w h i
chitisd i
rec to r i
n directs
upp
o
r
t
e
r
.I
fi
n
i
ti
a
ti
o
nc
on
d
i
t
i
on
wa
s
tr
u
e
i
n pri
orroun d an d P jha s not
don
e
s
o
,i
t
br
o
ad
ca
s
ts
“*

.R
ep
e
a
t
st
e
p
for al
lj= 1,2 ,
...,n .
3. [Commit] If process counter for Pj
>HI
G
H,
t
he
nt
h
ep
r
o
ce
s
s
co
m
m
i
ts
to aval
u e o f1.
4. [Termination] If k < 2m + 3, return to Step 2; else if 1 is committed,
processors agree on 1; else agree on 0.

NOTES: Initiation Condition : A processor initiates when (1) for k = 2, if


“ * “ received when k = 1, or (2) for k > 2 if |Cj
|
>LO
W+m ax(0, fl(k /2) -2 )
(s ou r
ce excluded)
.

You might also like