6.5 Election Algorithms -Avinash Madineni. Outline Introduction Types of Election Algorithms Present Scenario Ongoing research

Download 6.5 Election Algorithms -Avinash Madineni. Outline Introduction Types of Election Algorithms Present Scenario Ongoing research

Post on 19-Jan-2016

213 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

6.5 Election Algorithms

6.5 Election Algorithms-Avinash MadineniOutline Introduction Types of Election Algorithms Present Scenario Ongoing research

What are Election Algorithms Distributed algorithms require one process to act as coordinator, initiator, or otherwise perform some special role. It doesnt matter which process takes on this special role Why? To achieve SYNCHRONIZATION If all processes are exactly the same => no way to select one of them to be special

Goal of Election Algorithm To ensure that when an election starts, it concludes with all processes agreeing on who the new coordinator is

Assumptions Each process has a unique number. Eg- its network address We will assume one process per machine for simplicity Every process knows the process number of every other process But the processes do not know which ones are currently up and which ones are currently downTypes of Election Algorithms Traditional Election Algorithms Elections in Wireless Environments Elections in Large-Scale SystemsTraditional Election Algorithms-> The Bully Algorithm and the Ring Algorithm

The Bully Algorithm Was devised by Garcia Molina in 1982 If process notices that the coordinator is no longer responding to requests, it initiates an election The Bully Algorithm A process, P, holds an election as follows:1. P sends an ELECTION message to all processes with higher numbers.2. If no one responds, P wins the election and becomes coordinator.3. If one of the higher-ups answers, it takes over. P's job is doneContd.. A process can get an ELECTION message from one of its lower-numbered colleagues at any moment The receiver sends an OK message back to the sender to indicate that he is alive and will take over The receiver then holds an election, unless it is already holding one Eventually, all processes give up but one, and that one is the new coordinator The winner sends out a new message informing everyone that it is the new coordinator. If a process that was previously down comes back up, it holds an election and bullies the present coordinator and takes over

Explaining Bully Algorithm Group consists of 8 process numbered 0 to 7 Previously process 7 was the coordinator Process 4 is the first one to notice and sends out ELECTION messages to higher processes Processes 5 and 6 both respond with OK Process 4 hands over the election process. Process 5 and 6 takes over. Process 6 informs others that it is the new coordinator

Ring AlgorithmElection algorithm is based on the use of a ringAssume that the processes are physically or logically ordered, so that each process knows who its successor is.If a process notices that the coordinator is not functioning, it builds an ELECTION message containing its own process number and sends the message to its successorIf the successor is down, the sender skips over the successor and goes to the next member along the ring or the one after that, until a running process is locatedThe sender adds its own process number to the list at each step

Contd.. Eventually the message gets back to the process that started it all That process recognizes this event when it receives an incoming message containing its own process number Then the message type is changed to COORDINATOR and circulated once again This is to inform everyone who the new coordinator is and the who the members of the new ring are The COORDINATOR message is removed after it is circulated onceExample of Ring Algorithm

Processes 2 and 5 discover simultaneously that the previous coordinator, process 7, has crashed. Each builds an ELECTION message and circulates them independently Both messages will go all the way around and converts to COORDINATOR message After the COORDINATOR message goes around, Process 6 is declared the new coordinatorElections in Wireless Environments Traditional election algorithms are generally based on assumptions that are not realistic in wireless environments.For example - they assume that message passing is reliable and that the topology of the network does not change Vasudevan et al. (2004) proposed a solution that can handle failing nodes and partitioning networksContd.. Any node in the network, called the source, can initiate an election by sending an ELECTION message to its immediate neighbors When a node receives an election message, it designates the sender as parent. Then it sends out the ELECTION message to all its immediate neighbors except for the parent. A node merely acknowledges any message that is received from any other node apart from its parent

Contd..

Node a initiates an ELECTION message by broadcasting to nodes b and j Node b marks a as parent and passes the ELECTION message to node g The election message it transmitted till the leaf nodes Each nodes then transmit back the best available option to its parent node

Contd..

Node g has node e and h as child nodes but it will propagate only the best node i.e [h,8] back to its own parent. When multiple elections are initiated, nodes tend to join the ones having highest identifier in the source tagElections in Large-Scale Systems Above discussed situations deal with selecting one coordinator as they are small distributed systems For a larger network, a situation arises where we need to select super peers in a peer-to-peer network.

Contd..Requirements for Superpeers selection1. Normal nodes should have low-latency access to Superpeers.2. Superpeers should be evenly distributed across the overlay network.3. There should be a predefined portion of Superpeers relative to thetotal number of nodes in the overlay network.4. Each Superpeers should not need to serve more than a fixed number ofnormal nodes.Contd.. Requirements are relatively easy to meet in most peer-to-peer systems as the over lay network is either DHT based or randomly unstructured.

In DHT networks, Idea is to reserve a fraction of the identifier space for Superpeers Each node receives a m-bit identifier and first k bits are reserved to identify the Superpeers For N superpeers, first rlog2(N)l bits of any key can be used to identify the Superpeers Contd..

Total of N tokens are spread across N randomly-chosen nodes Each token represents a repelling force by which another token is inclined to move away If all tokens exert the same repulsion force, they will move away and spread evenly in the geometric spaceModified Election Algorithm-1 Uses several ordered nodes composing coordination group {coordinator, alternative1, alternative2,alternative k} These nodes prevent global election between all nodes Advantages Method intensively decreases the number of messages that should be exchanged between processes

Contd.. When Process 2 notices that the Process 7 is crashes, it sends crash-leader message to alternative 1 Alternative 1 sends ok message to process 2 Alternative 1 checks with process 7 before announcing itself as a coordinator

Modified Election Algorithm-2 After noticing the coordinator is down the process p[i] sends out an ELECTION message The process p[i] will receive OK messages from the nodes which are ACTIVE and higher than p[i] The process p[i] will select the biggest node it has received and announces it as a coordinator.Advantages This will reduce the no. of steps and the latencyFuture Work The Bully algorithm is one algorithms that is being modified to achieve better latency, reduced usage of bandwidth and reduced messages. Efforts are being made to improvise the Bully algorithm to best suit the Election mechanism in Wireless networks by considering Node degree and Residual Battery PowerReferences1] H. C. Cahng, C. C. Lo, A Consensus-Based Leader Election Algorithm for Wireless Ad Hoc Networks, 2012 International Symposium on Computer, Consumer and Control, Taichung, Dec. 2012.2] M. Gholipour, M. S. Kordafshari, M. Jahanshahi, A. M. Rahmani, A new approach for election algorithm in distributed systems 2009 Second International Conference on Communication Theory, Reliability, and Quality of Service,Colmar, France, Jul. 2009.3] M. Shirali, A. H. Toroghi, M. Vojdani, Leader election algorithms: History and novel schemes, 2008 International Conference on Convergence and Hybrid Information Technology, Busan, Nov. 2008.Questions?Thank you