modified bully election algorithm in distributed · pdf filemodified bully election algorithm...

10
MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS M. S. Kordafshari, M. Gholipour, M.Jahanshahi, A.T. Haghighat, Department of Electrical, Computer & IT, Islamic Azad University, Qazvin Branch, Qazvin, Iran Atomic Energy Organization of Iran (AEOI), NPPD, Tehran, Iran Abstract: Leader election is an important problem in distributed computing, and it is applied in many scientific fields such as communication network [1,2,3,4,5], centralized mutual exclusion algorithm [6,7], centralized control IPC, Berkeley algorithm, etc. Synchronization between processes often requires one process acting as a coordinator. The coordinator might not remain the same, because might get crashed. Bully election algorithm is one of the classic methods which is used to determine the process with highest priority number as the coordinator. In this paper, we will discuss the drawbacks of Garcia_Molina’s Bully algorithm and then we will present an optimized method for the Bully algorithm called modified bully algorithm. Our analytical simulation shows that, our algorithm is more efficient rather than the Bully algorithm with fewer message passing and fewer stages. Key-word: Bully algorithm, modified Bully algorithm, election, distributed systems, Message passing, coordinator 1. Introduction Election of a leader is a fundamental problem in distributed computing. It has been the subject of intensive research since its importance was first articulated by Gerard Le Lann [8] in 1977. The practical importance of elections in a distributed computing is further emphasized by Garcia_Molina’s Bully algorithm [9] in 1982. Based on a network topology, to elect a high- priority leader, many kinds of leader election algorithm have been presented. There are some algorithms about the election such as Fredrickson and Lynch [10], Singh and Kurose [11], etc. Other algorithms such as B.Awerbuch algorithm [12], Gallage & Humblet algorithm [13], Gafini algorithm [14], Chin & Ting Algorithm [15], Chow & Luo Algorithm [16] are based on spanning tree. Also some related papers proposed based on Ring Algorithm for b

Upload: votu

Post on 06-Feb-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS

M. S. Kordafshar

Department of Electrical,

Atomic Energy O

Abstract:

Leader election is applied in many scentralized mutual algorithm, etc. Synacting as a coordinmight get crashed. Bis used to determcoordinator. In thisBully algorithm analgorithm called mthat, our algorithmmessage passing an

Key-word:

Bully algorithm, modified Bpassing, coordinator

1. Introduction

Election of a leader is a problem in distributed combeen the subject of intenssince its importance was firby Gerard Le Lann [8] inpractical importance of eldistributed computing emphasized by Garcia_Moalgorithm [9] in 1982. Bnetwork topology, to el

b

i, M. Gholipour, M.Jahanshahi, A.T. Haghighat,

Computer & IT, Islamic Azad University, Qazvin Branch,Qazvin, Iran

rganization of Iran (AEOI), NPPD, Tehran, Iran

an important problem in distributed computing, and it iscientific fields such as communication network [1,2,3,4,5],exclusion algorithm [6,7], centralized control IPC, Berkeleychronization between processes often requires one processator. The coordinator might not remain the same, becauseully election algorithm is one of the classic methods whichine the process with highest priority number as the paper, we will discuss the drawbacks of Garcia_Molina’sd then we will present an optimized method for the Bullyodified bully algorithm. Our analytical simulation shows is more efficient rather than the Bully algorithm with fewerd fewer stages.

ully algorithm, election, distributed systems, Message

fundamentalputing. It hasive researchst articulated 1977. Theections in ais furtherlina’s Bullyased on a

ect a high-

priority leader, many kinds of leaderelection algorithm have been presented.There are some algorithms about theelection such as Fredrickson and Lynch[10], Singh and Kurose [11], etc. Otheralgorithms such as B.Awerbuchalgorithm [12], Gallage & Humbletalgorithm [13], Gafini algorithm [14],Chin & Ting Algorithm [15], Chow &Luo Algorithm [16] are based onspanning tree. Also some related papersproposed based on Ring Algorithm for

Page 2: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

electing the leader such as Change-Roberts [17], Peterson [18], Franklin[19], Hishberg [20], etc.For electing a leader many models ofsynchronous and asynchronouscomputation are described in [21,22]. Inasynchronous communication there is adelay in the transmission of messages [23]. Bully algorithm is one of the mostapplicable elections Algorithms that waspresented by Garcia_Molina in 1982.In this paper, we discuss the drawback ofsynchronous Garcia_Molina’s Bullyalgorithm and modify it with an optimalmessage algorithm. We show that ouralgorithm is more efficient thanGarcia_Molina’s Bully algorithm,because of fewer message passing andfewer stages.In future work we will implement ouralgorithm with asynchronous model inorder to decrease number of message

passing in asynchronous bully algorithm.The rest of paper is organized asfollows: In section 2 Garcia_Molina’sBully algorithm is briefly introduced andits advantage and disadvantage arediscussed. In section3 improved methodfor solving Bully algorithm drawbacks ispresented. In section 4 Garcia_Molina’sbully algorithm and our modifiedalgorithm are compared. In the section 5we conclude these algorithms .Finally inthe last section we explain future work.

2. Bully Algorithm

Bully algorithm is one of the mostapplicable election Algorithms whichwas presented by Garcia_Molina in1982. In this algorithm each process hasa unique number to distinguish them andeach process knows other’s processnumber. In this algorithm processes

Page 3: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

don’t know which ones are currently upand down. The aim of electionAlgorithm execution is selecting oneprocess as leader (Coordinator) that allprocesses agree with it. (I.e. process withthe highest id number).Suppose that the process P finds out thecoordinator crashed. This algorithm hasthe following steps: (As figure 1)Step1- when a process, P, notices thatthe coordinator crashed, it initiates anelection algorithm1.1-P sends an ELECTION message toall processes with higher numbersrespect to it.1.2- If no one responses, P wins theelection and becomes a coordinator.Step2- when a process receives anELECTION message from one of theprocesses with lower numbered responseto it:2.1- The receiver sends an OK messageback to the sender to indicate that it isalive and will take over.2.2- The receiver holds an election,unless it is already holding one. 2.3- Finally, all processes give up exceptone that is the new coordinator. 2.4- The new coordinator announces itsvictory by sending a message to allprocesses telling them, it is the newcoordinator. Step3- immediately after the processwith higher number compare tocoordinator is up, bully algorithm is run.

The main drawback of Bully algorithmis the high number of message passing.As it is mentioned before the messagepassing has order )( 2no that increasestraffic in network.The advantages of Bully algorithm arethat this algorithm is a distributedmethod with simple implementation.

This method requires at most five stages,and the probability of detecting acrashed process during the execution ofalgorithm is lowered in contrast to otheralgorithms. Therefor other algorithmsimpose heavy traffic in the network incontrast to Bully algorithm. Anotheradvantage of this algorithm is that onlythe processes with higher prioritynumber respect to the priority number ofprocess that detects the crashcoordinator will be involved in election,not all process are involved. In brief,Bully algorithm is a safe way forelection, however its traffic is relativelyhigh. In section 3 we proposed asolution to overcome these drawbacks.

3. Modified Bully Algorithm

As has been mentioned in section 2 inBully algorithm number of messagesthat should be exchanged betweenprocesses is high. Therefore this methodimposes heavy traffic in network.For solving this drawback we willpresent optimized method by modifyingthe Bully algorithm, that intensivelydecreases the number of messages thatshould be exchanged between processes.Furthermore the number of stages isdecreased from at most five stages to atmost four stages.Our algorithm has following steps: (figure2)Step1- When process P notices that thecoordinator has crashed, it initiates anelection algorithm.Step2- When the process P finds out thatthe coordinator is crashed, sendsELECTION message to all otherprocesses with higher priority number.Step3-Each process that receivesELECTION messages (with higher

Page 4: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

process than P) sends OK message withits unique priority number to process P.Step4- If no process responses to processP, it will broadcast oneCOORDINATOR message to allprocesses, declaring itself as acoordinator. If some process response toprocess P by comparing the prioritynumbers, the process P will select theprocess with the highest priority numberas coordinator and then sends to it theGRANT message.Step5- at this stage the coordinatorprocess will broadcast a message to allother processes and informs itself as acoordinator.Step6- immediately after the processwith higher number compare tocoordinator is up, our algorithm is run.New algorithm not only has alladvantages of Bully algorithm also itdoesn’t has the drawback of Bullyalgorithm (high number of messagepassing). Furthermore maximum number

of stages is decreased from five stages tofour stages.

It is clear that if process P crashes aftersending ELECTION message to higherprocesses, or crashes after receiving thepriority numbers from process withhigher priority number, higher processwait at most 3D time for coordinatorbroadcast. (D is average propagationdelay), If it will not receive, this processruns the modified algorithm. If a processwith higher priority number crashes aftersending its priority number to P, processP sends GRANT message to it meaningthat it is the highest process and P waitsfor broadcasting coordinator message. Ifafter D time, process P doesn’t receivesthe COORDINATOR message, itrepeats the algorithm again. Therefore we can use this algorithm asan efficient and safe method to selectingthe coordinator.

Page 5: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

3.1 A novel solution for a drawback ofBully algorithm

In Bully algorithm when more thanone process or all processes find out thatthe coordinator has crashedsimultaneously, all of them run inparallel Bully algorithm, therefore heavytraffic imposed to the network.For solving this problem in modifiedbully algorithm we act as follow(figure3). Step1-When process P realizes that thecoordinator has crashed, it initiatesmodified bully election algorithmpresented in section 3.Step2-When process P ' (P ' may be P)receives the ELECTION message fromprocess or processes with lower prioritynumber compare to itself, it waits a shorttime that can be specified perfectly andthen answers to the process with lowestpriority number only. In this situation ifP=P ' (This process initiates the algorithm

and also received the ELECTIONmessage from other processes), thenstops the algorithm.Step3-After process P ' answered to P, ifP ' receives an ELECTION message fromprocess R(R<P<P ' ), P ' answers toprocess R by sending its priority numberand sends STOP message to process P.Step4- when a process receives theSTOP message stops the algorithmimmediately.Step5- if process p neither receives anyresponse from other process(es),nor doesit receive any ELECTION message formprocesses with lower Priority number ,then in this case it can inform otherprocesses containing it(P) asCOORDINATOR.The pseudo code for this algorithm isrepresented in figure 4.

Page 6: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

4. Advantages of our algorithm in contrast with bully Algorithm

In this section we will compare Bullyalgorithm and modified bully algorithm:In point of number of stages: In point of number of stages Bullyalgorithm always is executed in fivestages, while our algorithm find out thecoordinator after four stages.

4.1 Analytical comparison of twoalgorithms if only one process detectsthe crashed coordinator

If only one process detects crashedcoordinator

:n The number of processes :r The priority number of processes thatfind out the crashed coordinator :)(rN The number of messages passingbetween processes when the r-thmember detects the crashed Coordinator.In bully modified algorithm the numberof massages passing between processesfor performing election is obtained fromthe following formula:

nrnN r +−= )(*2)( (1)

Which has Order )(no . In the worst casethat is 1=r (process with lowest prioritynumber finds out crashed coordinator):

13)1(*2)1( −=+−= nnnN (2) Whereas the number of massage passingbetween processes in the Bullyalgorithm for performing election isobtained from the following formula: 1))(1()( −+−+−= nrnrnN r (3)In the worst case that is 1=r (processwith lowest priority number detectscrashed coordinator): 12

)1( −= nN (4)

Which has Order )( 2nO Number of messages in modified bullyalgorithm will be equal to 13 −n thatobviously means this modified algorithmis better than bully algorithm with fewermessages passing and the fewer stages. Figure 5 clearly shows the comparisonbetween bully algorithm and modifiedbully algorithm (when one process findsout that crashed coordinator). Horizontalaxis indicates the priority number ofprocesses that find out crashedcoordinator, and vertical axis indicatesthe number of message passing. Forexample if the number of processes is1000 and 100th process finds out thatcrashed coordinator, in bully algorithmthe number of message passing is equal811899 but the number of messagepassing in modified bully algorithm isequal 2800.

4.2 Analytical comparison of twoalgorithms if set of },...,,{ 21 mrrrS = runthe algorithm simultaneously. Now assume that the set of processesin },...,,{ 21 mrrrS = from processes findout the crashed coordinator concurrently( 1r is lowest process):In bully algorithm the number ofmessage passing between processes forperforming election is obtained from thefollowing formula:

1))(1( 11 −+−+−= nrnrnT (5)In our modified algorithm the number ofmessage passing between processes forperforming election is obtained from thefollowing formula:

nrnrnTSrr

jjj

+−+−= ∑∈ }|{

1 )()( (6)

In bully algorithm the number ofmessage passing is based on the process

Page 7: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

with lowest priority number. That meansthere isn’t any difference between statethat only process 1r detects the crashedcoordinator and state that in witch the setof },...,,{ 21 mrrrS = detects crashedcoordinator. But in modified algorithm setof },...,,{ 21 mrrrS = are also important. Ifthe priority numbers of the processesthat detects the crashed coordinator ishigher, the number of message passingwill be decreased considerably.

5.Conclusion

In this paper, we discussed thedrawbacks of Garcia_Molina’s Bullyalgorithm and then we presented anoptimized method for the Bullyalgorithm called modified bullyalgorithm. Our analytical simulation

shows that our algorithm is moreefficient rather than the Bully algorithm,in both number of message passing andthe number of stages, and when only oneprocess run the algorithm messagepassing complexity decreased from

)( 2nO to )(nO (formula 1,3).In thisanalysis we consider the worst case inmodified algorithm. Result of thisanalysis clearly shows that modifiedalgorithm is better than bully algorithmwith fewer message passing and thefewer stages.

6. Future work In future work we will implement ouralgorithm with asynchronous model inorder to decrease number of messagepassing in asynchronous bully algorithm.

Page 8: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method
Page 9: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

7. References

[1]Sung-Hoon-Park, Yoon Kim, AndJeoung Sun Hwang “ An EfficientAlgorithm for Leader-Election inSynchrous Distributed Systems.” IEEETransaction on Computers, vol. 43, no.7, pp.1991-1994, 1999.[2] H. Abu-Amar and J. Lokre “ ElectionIn Asyncrouns Complete Network WithIntermitted Link Failures.” IEEETransaction on Computers, vol. 43, no.7, pp.778-788, 1994.[3] H.M. Sayeed, M. Abu-Amara, and H.Abu-Avara, “Optimal AsynchronousAgreement and Leader ElectionAlgorithm for Complete Networks withByzantine Faulty Links.” Distributed

Computing, vol.9, no.3, pp.147-156,1995.[4] J. Brunkreef, J.P. Katoen, and S.Mauw, “ Design and Analysis ofDynamic Leader Election Protocols inBroadcast Network, “DistributedComputing, vol.9, no.4, pp.157-171.1996[5] G. Singh, “Leader Election in thePresence of Link Failures,” IEEETransaction on Parallel and DistributedSystems, vol. 7, no. 3, pp.231-236,March 1996.[6] D.Menasce R.Muntz and J.Popek,” Alocking protocol for resourcecoordination in Distributed databases “

Figure5-The comparison of two algorithms if only one process finds outcrashed coordinator (n=1000)

Page 10: MODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED · PDF fileMODIFIED BULLY ELECTION ALGORITHM IN DISTRIBUTED SYSTEMS ... There are some algorithms about the election such as ... method

ACM TODS , VOL.5,NO.2,pp.103-138,JUNE 1980.[7] P.A Alsberg and J.Day “ A principlefor resilient sharing of DistributedResource “ in Proc.2nd Inte. Conf , onsoftware Engg.,(Sanfrancisco,Oct.1976).[8] G. Le Lan,”Distributed System –Towards a Formal Approach, ” InInformation Processing 77,B.Gilchrist,Ed.Amsterdam,Thenetherlands:North-Holland, pp.155-160.1977[9] H. Garcia-Molina, “Elections inDistributed Computing System,” IEEETransaction Comput, Vol.C-31,pp.48-59,Jan.1982.[10] G.Fredrickson and N.Lynch, “Electing a leader in a synchronous Ring", JACM, Vol 34,NO.pp-199-115 (JAN1987).[11] Singh, S., Kurose, J.F., “Electing‘good’ leaders (election leader algo-rithm),” Journal of Parallel andDistributed Computing, Vol. 21, No. 2,pp. 184-201. (May 1994)[12] CHANG E.,ROBERTS R. “ AnImproved Algorithm for DecentralizedExtrema-Finding in CircularConfigurations of processes.” Comm.ofthe ACM 22:5,pp.281-283, 1979[13] R. Gallager, P. Humblet, andP.Spira, “ A Distributed Algorithm forMinimum Weighted Spanning tree.”ACM trans.On programing Languageand Systems. 5(1):pp-77, 1983.[14] G. Gafini. “Improvement in timecomplexity of two message optimalalgorithm.” Proc. Princip;es ofDistributed Computing Conf., pp- 175-183, 1995.[15] F. Chin and H. F. Ting. “ AnAlmost Linear time and EMBEDEquation.3 Message DistributedAlgorithm for Minimum Weighted

Spanning Tree. Proc. Foundation ofComputer Science Conf., pp-257-266,1995.[16] R. Chow,K. Luo, and R. Newman-Wolf. “ An Optimal DistributedAlgorithm for Failure Driven LeaderElection in Bounded degree Network.”Proc IEEE Workshop on Future Tendsof Distributed Computing Systems, pp.136-141, 1996[17] PETERSON G.L “An O(nlogn)Unidirectional Algorithm for CircularExtrema problem . ACM Transaction onProgramming Languages andSystems”4:4,pp.758-762.1982[18] Wm. Randolph Franklin, "On anImproved Algorithm for DecentralizedExtrema Finding in CircularConfigurations of Processors," CACM,page 336-337. May 1982.[19] B.Awerbuch, “ Optimal DistributedAlgorithm for Minimum weightspanning tree, Leader Election andrelated problems” , ACM STOC,pp.230-240, 1987[20] D.S. Hirshberg and J.B. Sinclair. “Decentralized Extrim Finding in CircularConfigurations of Processors.”Communications of ACM, 23(11) pp-627-629, 1980 .[21] M. fischer, N. Lynch, and M.Paterson, “Impossiblity of DistributedConsensus with one Faulty Process,”Journal of the ACM, pp.374-382.(32)1985.[22] Tushar Deeppak Chandra and SamToueg. “ Unreliable Failure Detectorsfor Relaiable Distributed Systems”Journal of ACM, Vol,43 No.2, pp-225,267,March 1996 .[23]Sung-Hoon-Park,“A ProbablisticallyCorrect Election Protocol inAsynchronous Distributed System “,APPT, LNCS 2834, pp.177-183, 2003.