Transcript
Page 1: 6.5 Election Algorithms -Avinash Madineni. Outline Introduction Types of Election Algorithms Present Scenario Ongoing research

6.5 Election Algorithms

-Avinash Madineni

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

Outline• Introduction

• Types of Election Algorithms

• Present Scenario

• Ongoing research

Page 3: 6.5 Election Algorithms -Avinash Madineni. Outline 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 doesn’t 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

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

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 down

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

Types of Election Algorithms• Traditional Election Algorithms

• Elections in Wireless Environments

• Elections in Large-Scale Systems

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

Traditional 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

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

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 done

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

Contd..• 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

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

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

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

Ring Algorithm• Election algorithm is based on the use of a ring• Assume 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 successor• If 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 located• The sender adds its own process number to the list at each step

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

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 once

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

Example 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 coordinator

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

Elections 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 networks

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

Contd..• 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

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

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

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

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 tag

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

Elections 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.

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

Contd..Requirements for Superpeers selection

1. 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 the

total number of nodes in the overlay network.

4. Each Superpeers should not need to serve more than a fixed number of

normal nodes.

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

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

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

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 space

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

Modified 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

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

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

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

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 latency

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

Future 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 Power

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

References 1] 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.

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

Questions?

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

Thank you


Top Related