Upload
honey-agarwal
View
220
Download
0
Embed Size (px)
Citation preview
7/31/2019 Lec 10 AgreementProtocols
1/21
Agreement Agreement ProtocolsProtocols
CS60002:CS60002: DistributedDistributed SystemsSystems
PallaPalla bb DasguptaDasgupta
Dept.Dept. of of ComputerComputer Sc.Sc. && EngEng gg .,.,IndianIndian InstituteInstitute of of Technology Technology KharagpurKharagpur
7/31/2019 Lec 10 AgreementProtocols
2/21
K K K
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
3/21
ClassificationClassification of of FaultsFaults
BasedBased onon componentscomponents thatthat f f aa ilediled ProgramProgram // processprocess Processor Processor // machinemachine LinkLink StorageStorage
ClockClock
BasedBased onon behavior behavior of of faultyfaulty componentcomponent CrashCrash just just haltshalts FailstopFailstop crashcrash withwith additionaladditional conditionsconditions
OmissionOmission failsfails toto performperform somesome stepssteps ByzantineByzantine behavesbehaves arbitrarilyarbitrarily TimingTiming violatesviolates timingtiming constraintsconstraints
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
4/21
ClassificationClassification of of ToleranceTolerance
TypesTypes of of tolerance:tolerance: MaskingMasking systemsystem alwaysalways behavesbehaves asas per per specificationsspecifications eveneven
inin presencepresence of of faultsfaults Non-maskingNon-masking systemsystem maymay violateviolate specificationsspecifications inin presencepresence of of
faults.faults. ShouldShould atat leastleast behavebehave inin aa welwel ll-defined-defined manner manner
FaultFault toleranttolerant systemsystem shouldshould specify:specify: ClassClass of of faultsfaults toleratedtolerated WhatWhat tolerancetolerance isis givengiven fromfrom eacheach classclass
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
5/21
CoreCore problemsproblems
Agreement Agreement (multiple(multiple processesprocesses agreeagree onon somesome value)value) CC llockock syncsync hh ronizationronization StableStable storagestorage (data(data accessibleaccessible after after crash)crash) ReliableReliable communicationcommunication (point-t(point-t oo -point,-point, broadcast,broadcast, multicast)multicast)
Atomic Atomic
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
6/21
OverviewOverview of of ConsensusConsensus ResultsResults
LetLet f f bebe thethe maximummaximum number number of of faultyfaulty pp r r ocessors.ocessors.
TightTight boundsbounds for for messagemessage passing:passing:
CrashCrash failuresfailures ByzantineByzantine failuresfailures
Number Number of of roundsrounds f f ++ 11 f f ++ 11
TotalTotal number number of of processorsprocessors
f f ++ 11 3f 3f ++ 11
MessageMessage sizesize polynomialpolynomial polynomialpolynomial
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
7/21
IIII
OverviewOverview of of ConsensusConsensus ResultsResults
ImpossibleImpossible inin asynchronousasynchronous case.case. EvenEven if if wewe onlyonly wantwant toto toleratetolerate aa singlesingle crashcrash failure.failure. TrueTrue bothboth for for messagemessage passingpassing andand sharedshared read-writeread-write
memory.memory.
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
8/21
ConsensusConsensus Algorithm Algorithm for for CrashCrash FailuresFailures
CodeCode
for for
eacheach
processor:processor:
v v :=:= mymy inputinputatat eacheach roundround 11 throughthrough f+1:f+1:
if if II havehave notnot yetyet sentsent v v thenthen sendsend v v ttoo allall waitwait toto receivereceive messagesmessages for for thisthis roundroundv v :=:= minimumminimum amongamong allall receivedreceived valuesvalues andand
currentcurrent valuevalue of of v v if if thisthis isis roundround f+f+11 thenthen decidedecide onon v v
7/31/2019 Lec 10 AgreementProtocols
9/21
CorrectnessCorrectness of of CrashCrash ConsensusConsensus Algo Algo
Ter Ter mm ination:ination: ByBy thethe code,code, finishfinish inin roundround f f ++ 1.1.
Validity:Validity: HoldsHolds sincesince processorsprocessors dodo notnot introduceintroduce spuriousspurious messagesmessages
if if allall inputsinputs areare thethe same,same, thenthen thatthat isis thethe onlyonly valuevalue ever ever inin circulation.circulation.
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
10/21
CorrectnessCorrectness of of CrashCrash ConsensusConsensus Algo Algo
Agreement: Agreement: SupposeSuppose inin contradictioncontradiction pp j j decidesdecides onon aa smaller smaller value,value, x x ,,
thanthan doesdoes pp ii.. ThenThen x x waswas hiddenhidden fromfrom pp ii byby aa chainchain of of faultyfaulty
pp r r ocessors:ocessors:
round round roundf
roundf+1
q 1 1 q2 2 q f q f+1 p j
p i
ThereThere areare f f ++ 11 faultyfaulty processorsprocessors inin thisthis chain,chain, aa contradiction.contradiction.
7/31/2019 Lec 10 AgreementProtocols
11/21
ccc
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
12/21
IIII
PerformancePerformance of of CrashCrash ConsensusConsensus Algo Algo
Number Number of of processorsprocessors nn >> f f f f ++ 11 roundsrounds nn 2 2 |V||V| messages,messages, eacheach of of sizesize lologg |V||V| bits,bits, wherewhere
V V iiss thth ee inpuinpu tt set.set.
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
13/21
IIII
Lower Lower BoundBound onon RoundsRounds
Assumptions: Assumptions: nn >> f f ++ 11 everyevery processor processor isis supposedsupposed toto sendsend aa
messagemessage toto everyevery other other processor processor inin everyevery roundround
InputInput setset isis {0,1}{0,1}
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
14/21
ByzantineByzantine Agreement Agreement ProblemsProblems
ModeMode ll :: TotalTotal of of nn processes,processes, atat mostmost mm of of whichwhich cancan bebe faultyfaulty ReliableReliable communicationcommunication mediummedium FullyFully connectedconnected Receiver Receiver alwaysalways knowsknows thethe identityidentity of of thethe sender sender of of aa
messagemessage ByzantineByzantine faultsfaults SynchronousSynchronous systemsystem
InIn eacheach round,round, aa processprocess receivesreceives messages,messages, performsperforms computation,computation, andand sendssends messages.messages.
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
15/21
ByzantineByzantine Agreement Agreement
Also Also knownknown asas ByzantineByzantine GeneralsGenerals pp r r oblemoblem OneOne processprocess x x broadcastsbroadcasts aa valuevalue v v
Agreement Agreement Condition:Condition: All All non-faultynon-faulty processesprocesses mustmust
agreeagree onon aa commoncommon value.value. ValidityValidity Condition:Condition: TheThe agreedagreed uponupon valuevalue mustmust bebe v v if if x x isis nonnon --faulty.faulty.
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
16/21
VariantsVariants
ConsensusConsensus EachEach pp r r ocessocess broadcastsbroadcasts itsits initialinitial valuevalue
SatisfySatisfy agreementagreement conditioncondition If If initialinitial valuevalue of of allall non-faultynon-faulty processesprocesses isis v v ,, thenthen thethe
agreedagreed uponupon valuevalue mustmust bebe v v
InteractiveInteractive ConsistencyConsistency EachEach pp r r ocessocess k k broadcastsbroadcasts itsits ownown valuevalue v v k k
All All nono nn -faulty-faulty processesprocesses agreeagree onon aa commoncommon vector vector ((v v 11 ,v ,v 2 2 ,,,, v v nn ))
If If thethe k k thth processprocess isis non-faulty,non-faulty, thenthen thethe k k thth valuevalue inin thethe
vector vector agreedagreed uponupon byby nono nn -faultyprocesses-faultyprocesses mustmust bebe v v k k
SolutionSolution toto ByzantineByzantine agreeagree mm ent ent problem problem impliesimplies solutionsolution toto other other twotwo
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
17/21
ByzantineByzantine Agreement Agreement ProblemProblem
NoNo solutionsolution possiblepossible iif f :: asynchronousasynchronous system,system, or or nn
7/31/2019 Lec 10 AgreementProtocols
18/21
S
T U
S
T U
S
T UUUUUUUU
Proof Proof
Theorem:Theorem: ThereThere isis nono t-Byzantine-robust t-Byzantine-robust broadcast broadcast protocol protocol for for t t N/3N/3
S S0 0 1 1
0 0 1 10 0T U T U1 1
Scenario-0:Scenario-0: TT mustmust decidedecide 00 Scenario-1:Scenario-1: UU mustmust decidedecide 00
S Scenario-2:Scenario-2:0 1 ---- similar similar toto ScenariScenari oo -0-0 fofor r TT
0 1 ---- similar similar toto ScenariScenari oo -1-1 fofor r UU0 ---- TT decidesdecides 00 andand UU decidesdecides 11T U1
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
19/21
7/31/2019 Lec 10 AgreementProtocols
20/21
Lampor Lampor t-t-ShostaShosta k-k-PeasePease Algorithm Algorithm contd..contd..
For For t t >> 0,0, Broadcast Broadcast (( N,N, t t ):):
PulsePulse11 TheThe generalgeneral sendssends valval uuee ,, x x g g toto
allall processes,processes, thethe lieutenantslieutenantsdodo notnot send.send.
ReceiveReceive messagesmessages of of pulsepulse 1.1.
LieutenantLieutenant p p actsacts asas follows:follows:if if aa messagemessage valval uuee ,, x x waswas
receivedreceived fromfrom g g inin pulse-1pulse-1thenthen x x p p == x x elseelse x x p p == udef udef ;;
Announc Announc ee x x p p toto thethe other other
lieutenantslieutenants byby actingacting asasaa generalgeneral ininBroadcast Broadcast p p (( N N 11 ,, t t 11 )) inin thethe nextnext pulsepulse
PulsePulset t ++11 ReceiveReceive messagesmessages of of ppulseulse t t ++11 ..
TheThe generalgeneral decidesdecides onon x x g g .. For For lieutenantlieutenant p p ::
A A decisiondecision occursoccurs inin Broadcast Broadcast qq ((
N N 11 ,, t t 11 )) for for eacheach lieutenantlieutenant qq
WWpp [[qq ]] == decisidecisi oo nn ininBroadcast Broadcast qq (( N N 11 ,, t t 11 ))
y y p p == max max (W(Wpp ))
Dept. of CSE, IIT KGP
7/31/2019 Lec 10 AgreementProtocols
21/21
FeaturesFeatures
Ter Ter mm ination:ination: IIf f Broadcast Broadcast (( N N ,, t t )) isis startedstarted inin pulsepulse 1,1, everyevery processprocess decidesdecides inin pulsepulse t t ++ 11
DependenceDependence :: If If thethe generalgeneral isis correct,correct, if if therethere areare f f faultyfaulty pp r r ocesses,ocesses, andand if if N N >> 2 2 f f ++ t t ,, thenthen allall correctcorrect processesprocesses
decidedecide onon thethe inputinput of of thethe generalgeneral Agreement: Agreement: All All correctcorrect processprocess ee ss decidedecide onon thethe samesame
valuevalue
TheThe Broadcast Broadcast (( N N ,, t t )) protocol protocol isis aa t t --Byzantine-robust Byzantine-robust broadcast broadcast proto proto c c oo l l fofor r t t