1
Voting ProtocolIn Distributed system
By: Vasundhara GhoseB.Tech (CSE)
2
Topic covered : Need of voting protocol What is voting protocol? Types of voting protocol System model for static voting protocol Static voting protocol algorithm Vote assign ment policy Demo time Moving towards dynamic voting protocol conclusion
3
Why we need Voting protocols? Problem of service-denialNon-blocking protocols can’t
tolerateMultiple site failuresCommunication failuresNetwork partitioning failures
4
What is VOTING PROTOCOL? SET OF RULES FOR FAILURE RECOVERY
IN D.S. Assignment of no. of votes of Each
replica If(majority of votes collected)
{ Replica is accessed by process}
More fault tolerant than a commit protocol
5
Types of Voting protocols:
Types of voting
protocol
Static protocol
Dynamic protocol
6
What is static protocol?Proposed by Gifford.System model of S.V.P. :-
Replica of files lies on different sites.
Sites wants to access file
(LOCK EXISTS}
Site has to unlock it
7
System model for S.V.P. (coun..) Lock generating rules(while
assessing a file):One writer and No readersMultiple readers and no writers
Each site has lock manager. Lock manger >> LOCK related
operations Version number for every file
8System model for static voting protocol:
Version number stores In Stable storage
After every successful updating
Updates its Version number
9
If read or WRITE quorum needed
Site must collects certain number of votes
permission granted ,IF U HAVE Required VOTES
Basic !dea of Static Voting protocol:Assignment of votes to each replica Votes are collected by requesting process
10
Voting protocol algo: When process of site i requests for read/write Step 1: LOCK_REQUEST Step 2: Vote_REQUEST(WHEN lock is granted)Step 3: reception of VOTE REQUEST at site j
If(lock request granted){
return( VN , NO. of votes assigned to replica );
} to site i
11
Voting protocol algo(cout..):
Weather I have
quorum or not ??
Site i
Okay let me decide on basis of rule of algorithm
12
If(Request is for Read)Vr=ΣVk
P= sets of sites which have replied
Vk= No of votes assigns/given by site k
If (Vr>= r )
{
Successful in obtaining read quorum
}
13
If(Request is for WRITE)VW=ΣVk
P= sets of sites which have replied
Vk= No of votes assigns/given by site k Q can be defined as
M=max{VNj : j€P}Q={j€P : VNj=M}
If (VW>= W )
{
Successful in obtaining WRITE quorum(w)
}
14
If ( Site’s request is unsuccessful)
{ RELEASE_LOCK
to all sites and its lock manger
}
If ( site’s request gets Quorum)
{ if(Weather it is
latest copy or not)
yes-> next step
No> obtain current copy
}
15
If ( request was for read)
{ Read the latest
current copy available locally
}
If ( Reqest for write)
{ Update local copy
Update Version number
Send all updates and version
number to all sites Q
}
16
Last steps of SVP RELEASE_LOCK REQUEST to all manager
and all sites in PAfter receiving > updating in local copy by
sitesReleasing of locks (after receiving
RELEASE_LOCK)
17
Vote assignment policy:
V= total no. of votes assigned to all the replica
R= read quorum ; w=write quorum
r + w > v w > v/2
18
Condition to be satisfied by r and w:None of old copies are updated.W = sum of subsets of replicaR intersection w != nullW value should high and high for
disallowing simultaneous updating
19
Demo time:
1
3
24
Votes=175 msecs
Votes=1750 msecs
Votes=2750 msecs
Votes=1100 msecs
Case 1: r=1 and w=5Case 2: r=w=3Case 3: site 3 is more reliable
20
So this type of voting scheme is known as static voting scheme,
because voting assign policy does not bother with state of
system..
21
Limitation of SVP:
1
3
24
Votes=175 msecs
Votes=1750 msecs
Votes=1750 msecs
Votes=2100 msecs
Case 4: Site 3 fails /unreachable,simultanously with any site unavailable
22
We face:System failure /non-working state.
Solution >> Dynamic voting protocol
DVP solves problem by adapting nature
It adapt number of /set of sites that can form quorum
Prevention from communication failure
23
Approaches of DVP• Adaptive set of
sites• To allow access to
data for updating when state of system change.
Majority based
approach
• The number of votes changes assigned to sites
• To allow access to data for updating when state of system change
Dynamic vote re-assignm
ent
24
Conclusion:Dynamic voting protocol ensures
more availability than static voting protocol.
Static voting protocol is non-adaptive in nature, that's why its hard to survive for that.
Selection time dependent on system characterstics in dynamic voting protocol.
25THANK
YOU Voti
ng p
roto
col