Wednesday, 5 June 2019

Difference Between Bully and Ring Algorithm

Difference Between push around and Ring AlgorithmComp be bully and ring preference algorithmic programic programic ruleChoose or bearing an algorithms in distributed system is a big ch solelyenging issue since past until now. The big ch all(prenominal)enge is calls for a suitable, efficient and no error alternative algorithm. Nodes lead with each different using sh bed memory and through or via contentedness foundering. Coordinator exit be the key requirement for customers to execute or fight any distributed task effectively and smoothly. There lead be no central controlling node exists in a pure distributed system, every node has to communicate other nodes in the network to make an important decision. During the decision military operation all nodes entrust not often make the same decision. solely involve the decision-making dish out and communication between nodes time-consuming. When consistency is needed, among all the nodes Coordination among nodes becomes harde r.The main purpose of the leader option is to choose a node as a coordinator. It forget act as a leader and coordinate activities of the whole system. A leader in any leader election algorithm is unremarkably chosen based on the node which has the largest identifier. The nodes go out reach a state called as terminated state once the leader is readed. There are 2 states which are elected states and non-elected states in the leader election algorithms. When a node enters either state, it always ashes in that state. The leader election algorithm has to satisfy liveness condition and safety for an execution. The safety condition requires that only adept single node can enter the elected state and it will become the leader of the distributed system. The liveness condition states that every node will eventually enter an elected state or a non-elected state.There are many election algorithms been proposed everyplace the years such as Bully algorithm, Ring algorithm, Chang and Robe rts algorithm, Le Lanns algorithm, and Franklins algorithm. wholly these algorithms require nodes to be directly involved in leader election. Nodes will transmit the put acrosss to one another for exchange nurture until an agreement is reached. Once a node is been selected as leader, all the nodes will eff the role as that node as leader.Bully algorithmThe algorithm was devised by Garcia-Molina in 1982. While one of the process notices that the coordinator is not active, crashed, or responding to requests, it will start an election. Process Q, holds an election as follows-Q sends a depicted object to all the processes with higher meter to start the election.-Q wins the election and becomes coordinator if and only if no higher get alongs responds.-If there is one of the higher-ups function answers, it takes over. Qs job is finish or do.A process can receive an Election kernel from any one of its commence- crooked nodes at any moment. The receiver sends a confirmation subs tance back to tell the sender that it is active and will take over when an Election message get. If other processes do not respond, and there is only one then it will become the new coordinator. later on that, it will send all processes a message to presage its victory and starting immediately it will be the new coordinator.If a process that was d deliver before but come back up, it will hold an election. If it happens to be the highest- progenyed process among other currently running processes, it will win the election then will become leader and take over the coordinators job.Process 4 holds an electionProcess 5 and 6 respond, telling 4 to stopNow 5 and 6 each hold an electionProcess 6 tells 5 to stopProcess 6 wins and tells everyone circumscribed Bully AlgorithmIn Bully algorithm, the number of message be transfer between processes is very high. Thus, this change Bully Algorithm been devised to reduce the heavy duty in network. alike to reduce the heavy traffic flow in net work, the number of stages is decreased from at most five stages to at most four stages.The algorithm has following steps1st stepWhen process Q notices coordinator had crashed, it will start an election.second stepQ will send Election message to all other processes with higher priority numbers when Q find out that the coordinator was crashed. tertiary stepAll the processes that receives message which with higher priority process than Q will send OK message back to process Q with its unique priority number. fourth stepIf no processes responses to process Q, Q will broadcast one Coordinator message to all processes to declare itself as a coordinator. In vice versa, process Q will select the process Q with the highest priority number as coordinator and then send to it the GRANT message.5th stepCoordinator process will broadcast message to all the processes and informs them that itself as a coordinator at this stage.sixth stepAfter the process with higher number compare to coordinator i s up, modified Bully algorithm is run immediately. It does not have the drawback of Bully algorithm which has high number of message liveing.If a higher priority number process crashes after sending it priority number to Q, Process Q will send GRANT message to it meaning that itself is the highest process and Q counts for broadcasting coordinator message else it will continue run the modified Bully algorithm. After a certain time or period, process Q does not receives any Coordinator message, it will repeat the algorithm again.Thus, this algorithm is efficient and safe to use for select the coordinator.Figure 2The modified Bully election algorithmProcess 2 holds an election.Processes 3, 4, 5 and 6 respond, telling its unique priority number.Now 3 comparing the priority number and select the highest process (process 6) and send a message to its (GRANT).Process 6 tell to everyone that it is coordinator. detail Ring algorithm type ring algorithm is totally different with Bully algori thm. It achieves mutual exclusion by creating a bus network of processes in distributed system. It does not have a real ring in the network but a logical ring is constructed with all processes and all processes are assigned a position in the ring. All the processes know who is before them and b decreeing after them in the line. minimal Ring algorithm works1st step Process 6 is down.2nd step Process 3 notices that Process 6 does not respond. So it starts an election, sending a message containing its id to the next node in the ring.3rdstep Process 5 passes the message on, adding its own id to the message.4th step Process 0 passes the message on, adding its own id to the message.5th step Process 1 passes the message on, adding its own id to the message.6th step Process 4 passes the message on, adding its own id to the message.7th step When Process 3 receives the message back, it knows the message has gone around the ring, as its own id is in the list. Picking the highest id in the lis t, it starts the coordinator message 5 is the leader around the ring.8th step Process 5 passes on the coordinator message.9th step Process 0 passes on the coordinator message.10th step Process 1 passes on the coordinator message.11th step Process 4 passes on the coordinator message. Process 3 receives the coordinator message, and stops it.Modified sign Ring algorithmThis algorithm is modified from Token Ring algorithm. It is modified to reduce the number of message passing and additional message being sent to the elected leader.When the leader has crashed and been noticed by a node, it will send its ID number to the node next to it in the ring. It is not necessary for all nodes to send their IDs into the ring. The receiving node compares the received ID with its own, and forwards whichever is the greatest at this moment. But this comparison is done by all the nodes such that only the greatest ID continues in the ring. After that, the greatest ID will return to the initial node. I t declares itself as the leader by sending a coordinate message into the ring if the received ID equals that of the initial sender.This method will dramatically reduce the overhead involved in message passing. Besides that, if there is many nodes notice the leader crashed or absence at the same time, only the message of greatest ID node circulates in the ring and it will prevent the smaller IDs from being sent message in the ring.Modified Token Ring algorithm worksNodes 2 and 4 notice that the coordinator has crashed simultaneouslyThey send their IDs into the ringThe greatest ID always remain in the ringThe greatest ID prevail passing in the ring5 is declared as the leaderAdvantages and limitation algorithmsBully algorithm and Modified Bully algorithmBoth of these algorithms have almost the same advantages. They can always check the liveness of the leader by the assumption of message delivery. The process is chosen as the non-crashed process at the end of the run with the largest p rocess number if no process is replaced. It is im likely for two processes to decide which coordinator among them is, since the process with the lower number will discover that the other exits and defer to it.However, Modified Bully algorithm has another advantage that Bully algorithm does not have. That is the lower traffic passing. It reduce the traffic in the message communicate passing compare to Bully algorithm. It does not let the lower numbered process involve in the election but dependable higher numbered process. It also will send a GRANT message to the process which wins in the election. Then the process which wins will announce the message that declares itself as leader to all the nodes. It is more less traffic flow in the process and it is more than better than Bully algorithm.The Bully algorithm also suffers from many shortcomings. This algorithm is not guaranteed to meet the safety condition if processes that had crashed and replaced by processes with the same number . A process that replaces the crashed process Q may decide which has the highest number just as another process has decided that it has the highest number. Both of them will announce themselves as the coordinator in a same time. But unfortunately, there are no guarantees on message passing order, and the recipients of these messages may give out different conclusion on which is the coordinator process. The condition may be broken if the expect timeout appraises turn out to be accurate. That means if the processes failure detector is unreliable.Token Ring algorithm and Modified Token Ring algorithmToken Ring and Modified Token Ring algorithm are having very special routing. It is totally different with the Bully algorithm. They know the process next to them and just passing the message to the process which next to them. It is overmuch more simple compare to other algorithm. They just need to take the information from beside, add the value and pass to another side. The message pass ing traffic is very much lower than other algorithms. This is because they just pass the information to the next process after that no more communicate with other processes. This reason make the algorithm become much easier to carry out. Compare with the bully algorithm which need keep communicate with all the process, Token Ring just need the message passing around the ring and know all the information about which one process having the higher numbered process. After that, the process can decide after compare and get the highest numbered process. Then, it just needs passing a decision message around the ring to announce or declare the leader in the ring.Meanwhile, the token ring and modified token ring also have their different. Token ring needs add up the information when the leader is crashed or down. Then the message or information will keep pass and to next process and the process will add its own ID into the message and passed to the process next to it. It will keep on going u ntil the message reaches the process which starts the election process. Hence, the process will compare the information then announce the new leader by passing the coordinator message to the next process and keep on passing it in the ring.But the modified token ring will have slightly different. When the process notice the leader is crashed and start the election, the information message passing will start. When the message passing in the ring, it will compare the results collect from the processes. In the comparison, the highest numbered processs ID only will remain stay in the information message. Those smaller numbered processes ID will be deleted or will not be put inside the information message. When the information message finish a round, it will straight away start announce or pass the coordinator message to all the process for the new leader been selected. It is much easier and simple for the information message. All the comparison will be done when the new ID want to add in to the information message. It not just save the time and no need wait until the end just compares the information that get from all processes. It also make the information message smaller and the message passing consumed less time to pass to the next process.The limitations for Token Ring and Modified Token Ring algorithm are they both also consumed a lot of time in message passing. It needs to pass and get the information message. It will take a round to get all the information. For those smaller processes, they also need to involve in the passing message process even they also would not been selected as a leader. It will take much more time compare with other algorithms. After the leader had been selected, the coordinator message also needs to pass around all the processes in the ring. The coordinator message will not pass to all the processes at once but it will pass from one to another one. All these processes really consumed and waste a lot of time compare with other algorithm s.Besides above limitation, the message passing around the ring sometimes also will miss. When the information or coordinator message passing around the ring, it will possible loss or miss out. After that, it need take time to been noticed and regenerate the information message passing. Hence, the message needs to restart pass among the processes. This make the process for the election for leader consumed longer than other algorithms.Algorithms analysisIn modified Bully Algorithm, if a single node detects the coordinator is crashed, N (i) with an order of O (n) is obtained as followsThe order of message passing increase to O(n2) with fault tolerance as followsWhere i is the selected leader ID number.The bully algorithm against the Modified Bully algorithm has been plots for the case when one node notices that the coordinator has crashed.From the graph, the traffic for the Bully algorithm from the beginning is much higher than modified Bully algorithm. Hence it keeps decrease when th e process ID noticed increased. Meanwhile, the modified Bully algorithm is having a nearly constant for number of message passing. This shows that the traffic in the modified Bully algorithm is much less than Bully algorithm. That means modified Bully algorithm is better than Bully algorithm and has lower traffic flow when election happens.In Token Ring algorithm, the number of message passed with an order of O (n2) isFor the modified Token Ring algorithm isThe number of messages passed reduced and the complexity is much lower.From the graph above, the number of message passing in the ring for the Token Ring algorithm keep increase when the number of processes notices that the coordinator has crashed. But for the modified Token Ring algorithm, the number of message passing in the ring has not much different compare to non-modified. This shows that the traffic flow in the ring for modified ring is much lower than non modified.ConclusionLeader election algorithms play an important rol e in distributed system. The modified Bully algorithm and Modified Token Ring algorithm are efficient and easier to implement in all cases if compare to the existing one. But, still need a lot of improvement have to be done so that the algorithms can be more safety and efficient in the electing the coordinator in distributed system.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.