Algo
Algo
Preethi Vishwanath
San Jose State University
Computer Science
October 3rd 2006
Agreement Problem
Agreement problem Relationship between the stopping
– Processes start with individual and the Byzantine agreement
inputs from a particular value set problem
V.
– All the non faulty processes are – Not necessary that an algorithm
required to produce outputs from that solves Byzantine’s problem
the same value set V, subject to would solve stopping failure.
simple agreement and validity – Difference is that in the stopping
conditions case, we require that all the
– Assumption for validity – all processes that decide, even those
processes begin with the same that subsequently fail, must agree.
value v, the only allowed decision – If the agreement condition, for the
value is v. stopping failure case is replaced
by the one for the Byzantine
Assumptions failure case, then the implication
does hold.
– Network is a n-node connected
undirected graph with processes – Alternatively, if all the non faulty
1,..,n, where each process knows processes in the Byzantine
the entire graph. algorithm always decide on the
same round, then the algorithm
– For each process there is exactly also works for stopping failure.
one start state containing each
input value.
– Links are perfectly reliable, all .
messages send are delivered.
Failure modes
– Stopping failure model – Byzantine Failure model
Lemma
1. If no process fails during a particular round r, 1<= r <= f+1, then Wi(r) = Wj(r) for
all I and j that are active after r rounds.
2. Suppose that Wi(r) = Wj(r) for all I and j that are active after r rounds. Then for
any round r1, r <= r1 <= f+1, the same holds, that is, W i(r1) = Wj(r1) for all I and j
that are active after r1 rounds.
3. If processes i and j are both active after f+1 rounds, then W i = Wj at the end of
round f+1
Theory
1. Floodset solves the agreement problem for stopping failures
*1 V : Input Set
*2 f : Limited amount of processes which may fail
*3 Singleton set : a singleton is a set with exactly one element.
Exponential Information Gathering Algorithms
For every string x that occurs as a label of a node of T, each process has a variable
val(x).
Initially, each process i decorates the root of its tree with its own initial value, that is,
it sets its val(λ) to its initial value.
Round 1:
Process i broadcasts val(λ) to all processes, including i itself. Then process i records the
incoming information
1. If a message with value vЄV arrives at i from j, then i sets its val(j) to v.
2. If no message with a value in V arrives at i from j, then i sets val(j) to null.
Round k, 2 <= k <= f+1: Process I broadcasts all pairs (x,v), where x is a level k-1
label in T that does not contain index I, v ЄV, and v=val(x). Then process I records
the incoming information.
1. If xj is a level k node in T, where x is a string of process indices and j is a single index, and
a message saying that val(x)= vV arrives at i from j, then I sets val(x j) to v.
2. If xj is a level k node label and no message with a value in V for val(x) arrives at i from j,
then i sets val(xj) to null.
At the end of f+1 rounds, process i applies a decision rule. Namely, let W be the set
of non-null vals that decorate nodes of i’s input value.
EIG tree : data structure for recording various values along communication paths.
Byzantine Failure Algorithms
Assumptions – Execution α2:
– Processes 1,2, and 3 solve the Symmetric to α1
Byzantine agreement problem, Process 2 and 3 are non faulty and
tolerating one fault. start with initial values of 0, while
process 1 is faulty and starts with an
– They decide at the end of two rounds initial value of 1.
and that they operate in a particular, 1st round – all processes report their
constrained manner: value truthfully
at the first round, each process 2nd round – process 2 and 3 report
simply broadcasts its initial value, truthfully what they heard in the first
In the second round, each process round, while process 1 tells 3(falsely)
reports to each other process what that 2 sent 1 in round 1 and
was told to it in the first round by the otherwise behaves truthfully.
third process.
– Execution α3:
– Execution α1: Suppose process 1 and 3 are non
Process 1 and 2 are non faulty and faulty and start with 1 and 0,
start with initial values of 1 respectively.
Process 3 is faulty and starts with an Process 2 is faulty, telling 1 that its
initial value of 0. initial value is 1 and telling 3 that its
1st round – all processes report their initial value is 0.
value truthfully. All processes behave truthfully in the
2nd round – processes 1 and 2 report second round.
truthfully what they heard in the first
round, process 3 tells 1(falsely) that
2 send 0 in round 1 and otherwise
behaves truthfully.
EIG Algorithm for Byzantine Agreement
Presupposes that the number of processes is large relative to the number of
faults.
n > 3f
Difference is that a process that receives an “ill-formed” message corrects
the information to make it look sensible.
EIGByz algorithm
– Processes propagate values for f+1 rounds.
– Exception : If a process i ever receives a message from another process j that is
not of the specified form then i “throws away” the message, that is, acts just as if
process j did not send it anything at that round
– f+1 rounds; process i adjusts its val assignment so that any null value is replaced
by the default value v0.
– To determine its decision; process i works from the leaves up in its adjusted,
decorated tree.
– For each leaf labeled x, newval(x) := val(x).
– For each non-leaf node labeled x, newval(x) is defined to be the new val held by
a strict majority of the children of node x
– If no majority exists, process I sets newval(x):=v0.
– Process I’s final decision is newval(λ)
General Byzantine Agreement Using Binary Byzantine
Agreement
Each process has local variables x,y,z and vote, x initialized to process’s
input value; y,z and vote initialized arbitrarily.
Round 1: Process i sends value x to all processes, including itself
– If there are >= n-f copies of a particular value vЄV, then i sets y:=v, otherwise
y:=null
Round 2: Process i sends value y to all processes, including itself
– If there are >= n-f copies of a particular value in V, then I sets vote := 1;
otherwise vote := 0.
– I sets z equal to non-null value that occurs most often among the messages
received by I at this round, with ties broken arbitrarily
Round r, r >= 3: Processes run the binary Byzantine agreement sub-routine
using the values of vote as the input values.
– If process i decides 1 in the subroutine and if z is defined
– Final decision of the algorithm is z
– Otherwise default value v0.
Best Algorithms
OptFloodSet algorithm
– Best Algorithm for Stopping Failure
– Uses f+1 rounds
– 2n2 messages
– O(n2b) bits of communication.
EIGByz algorithm
– Byzantine case
– Uses f+1 rounds
– Exponential amount of communication
PolyByz
– Byzantine case
– Uses 2(f+1) rounds
– Polynomial amount of communication
k-agreement problem
Natural generalization of the ordinary agreement problem
Instead of requiring that all processes decide on exactly the same value, we insist only that
they limit their decision to a small number, k of distinct values
Practical Situations
Videotape, desirable for a number of processes to agree on a small number of frequencies to use for
the broadcast of a large number of data.
Assume that the network is a n-node connected undirected graph with processes 1,..,n; where
each process knows the entire graph
Each process starts with an input from a fixed set V and is supposed to eventually output a
decision from the set V.
Assume that at most f processes might fail.
Only stopping failure considered
Agreement :
There is a subset W of V, |W|=k, such that all decision values are in W.
Validity:
Any decision value for any process is the initial value of some process.
Termination:
All nonfaulty processes eventually decide.
FloodMin Algorithm
Each process maintains a variable min-val, originally set to its own initial value.
For each [f/k]+1 rounds, the processes all broadcast their min-vals
Each process resets its min-val to the minimum of its old-val and all the values in the
incoming messages.
The decision value is min-val
Formal Algorithm
Where
n : number of processes
f : number of failures tolerated
k : allowed number of decision values
Bermuda Triangle
All executions assigned to vertices on the
lower edge have inputs chosen from {0,1}.
Agreement
The decision values of any pair of nonfaulty processes are within Є of each other.
Validity
Any decision value for a nonfaulty process is within the range of the initial values of the
nonfaulty processes.
Termination
All nonfaulty processes eventually decide.
– Processes run an ordinary Byzantine agreement to decide on the value for each process.
– All these algorithms run in parallel.
– In the algorithms for process i, i begins by sending its message to all processes in round 1,
then all processes use the received values as their inputs.
– When these algorithms terminate, all nonfaulty processes have the same decision values for
all processes.
– Each chooses the [n/2]th largest value in the multiset of decision values as its own final
decision value.
ConvergeApproxAgreement algorithm:
Transitions: If a request
Tick clock(t) arrives, Clock
Precondition: Precondition: responds ( in a
true flag = true separate step)
counter = t with the current
Effect: Effect: value of the
counter := counter+1 flag:=false
counter.
Request
Effect:
flag := true
Tasks:
{tick}
{clock(t) : t Є N