SlideShare a Scribd company logo
SCHOOL OF ENGINEERING & TECHNOLOGY | ADAMAS UNIVERSITY | KOLKATA
Election Algorithms
Presented by,
Sayan Ghosh
M.Tech(CSE)
Outline
• Election Algorithms
➔ Introduction
• Traditional Election Algorithms
➔ Bully Algorithm
➔ Ring Algorithm
Need of a Coordinator
• Many algorithms used in distributed systems require a coordinator.
• In general, all processes in the distributed system are equally suitable
for the role of an coordinator.
• Election algorithms are designed to choose a coordinator.
Election Algorithms
Election algorithms choose a process from group of processors to act as a
coordinator. If the coordinator process crashes due to some reasons, then a
new coordinator is elected on other processor. Election algorithm basically
determines where a new copy of coordinator should be restarted.
Election algorithm assumes that every active process in the system has a
unique priority number. The process with highest priority will be chosen as a
new coordinator. Hence, when a coordinator fails, this algorithm elects that
active process which has highest priority number.Then this number is send to
every active process in the system.
Contd.
• Every node has a unique id(i.e. process no).
• Every process need to know their respective id numbers.
• The process with the highest id no will be the coordinator.
Bully Algorithm
• When a process notices that the coordinator is no longer responding to
requests, it initiates an election.
• 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.If a
process can get an ELECTION message from one of its lower-numbered
colleagues. Message arrives to 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.
Contd.
• Eventually, all processes give up but one, and that one is the new
coordinator.
• It announces its victory by sending all processes a message telling them
that starting immediately it is the new coordinator.
• If a process that was previously down comes back up, it holds an election.
• If it happens to be the highest-numbered process currently running, it will
win the election and take over the coordinator's job.
• Thus the biggest guy in town always wins, hence the name "bully
Example
Contd.
• The group consists of 8 processes. Previously process 7 was the
coordinator, but it has just crashed.
• Process 4 is the first one to notice this, so it sends ELECTION messages
to all the processes higher than it, namely Processes 5 and 6 both
respond with OK.
• Upon getting the first of these responses, 4 knows that its job is over. „
Both 5 and 6 hold elections, each one only sending messages to those
processes higher than itself.
• Process 6 tells 5 that it will take over. „6 knows that 7 is dead and that it
is the winner.
Contd.
• 6 announces this by sending a COORDINATOR message to all running
processes.
• When 4 gets this message, it can now continue with the operation it was
trying to do when it discovered that 7 was dead, but using 6 as the
coordinator this time.
• If process 7 is ever restarted, it will just send all the others a
COORDINATOR message and bully them into submission.
Ring Algorithm
Based on the use of a ring.
• Assume: the processes are physically or logically ordered, so that each
process knows who its successor is.
• When any 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.
Contd.
• At each step, the sender adds its own process number to the list in the
message.
• 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.
• At that point, the message type is changed to COORDINATOR and
circulated once again, this time to inform everyone else who the
coordinator is (the list member with the highest number) and who the
members of the new ring are.
• When this message has circulated once, everyone goes back to work.
Example
● When the message
returns to p, it sees its
own process ID in the list
and knows that the
circuit is complete.
● P circulates a
COORDINATOR message
with the new high
number. Here, both 2
and 5 elect 6:
[5,6,0,1,2,3,4]
[2,3,4,5,6,0,1]
Contd.
• Two processes, 2 and 5, discover simultaneously that the previous
coordinator, process 7, has crashed.
• Each of these builds an ELECTION message and starts circulating it.
• Eventually, both messages will go all the way around, and both 2 and 5
will convert them into COORDINATOR messages, with exactly the same
members and in the same order.
• When both have gone around again, both will be removed.
• It does no harm to have extra messages circulating – at most it wastes a
little bandwidth
Thank You!

More Related Content

What's hot

Routing algorithm
Routing algorithmRouting algorithm
Routing algorithmBushra M
 
Processor allocation in Distributed Systems
Processor allocation in Distributed SystemsProcessor allocation in Distributed Systems
Processor allocation in Distributed SystemsRitu Ranjan Shrivastwa
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Akila Krishnamoorthy
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionSHIKHA GAUTAM
 
Equivalence of DFAs and NFAs.pptx
Equivalence of DFAs and NFAs.pptxEquivalence of DFAs and NFAs.pptx
Equivalence of DFAs and NFAs.pptxSamyakJain710491
 
Multiple access control protocol
Multiple access control protocol Multiple access control protocol
Multiple access control protocol meenamunesh
 
Multiple Access in Computer Network
Multiple Access in Computer NetworkMultiple Access in Computer Network
Multiple Access in Computer NetworkHitesh Mohapatra
 
Checkpointing.pptx
Checkpointing.pptxCheckpointing.pptx
Checkpointing.pptxAzmiNizar1
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architectureMaulik Togadiya
 
Chess board problem(divide and conquer)
Chess board problem(divide and conquer)Chess board problem(divide and conquer)
Chess board problem(divide and conquer)RASHIARORA8
 
Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed SystemsDr Sandeep Kumar Poonia
 
Computability - Tractable, Intractable and Non-computable Function
Computability - Tractable, Intractable and Non-computable FunctionComputability - Tractable, Intractable and Non-computable Function
Computability - Tractable, Intractable and Non-computable FunctionReggie Niccolo Santos
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazardAJAL A J
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed systemSunita Sahu
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 

What's hot (20)

Routing algorithm
Routing algorithmRouting algorithm
Routing algorithm
 
Processor allocation in Distributed Systems
Processor allocation in Distributed SystemsProcessor allocation in Distributed Systems
Processor allocation in Distributed Systems
 
Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)Automata theory - Push Down Automata (PDA)
Automata theory - Push Down Automata (PDA)
 
Distributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithmsDistributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithms
 
Branch and bound
Branch and boundBranch and bound
Branch and bound
 
Distributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock DetectionDistributed Mutual Exclusion and Distributed Deadlock Detection
Distributed Mutual Exclusion and Distributed Deadlock Detection
 
Resource management
Resource managementResource management
Resource management
 
Equivalence of DFAs and NFAs.pptx
Equivalence of DFAs and NFAs.pptxEquivalence of DFAs and NFAs.pptx
Equivalence of DFAs and NFAs.pptx
 
Multiple access control protocol
Multiple access control protocol Multiple access control protocol
Multiple access control protocol
 
Multiple Access in Computer Network
Multiple Access in Computer NetworkMultiple Access in Computer Network
Multiple Access in Computer Network
 
Checkpointing.pptx
Checkpointing.pptxCheckpointing.pptx
Checkpointing.pptx
 
5 csp
5 csp5 csp
5 csp
 
Distributed shred memory architecture
Distributed shred memory architectureDistributed shred memory architecture
Distributed shred memory architecture
 
Data link layer
Data link layer Data link layer
Data link layer
 
Chess board problem(divide and conquer)
Chess board problem(divide and conquer)Chess board problem(divide and conquer)
Chess board problem(divide and conquer)
 
Processes and Processors in Distributed Systems
Processes and Processors in Distributed SystemsProcesses and Processors in Distributed Systems
Processes and Processors in Distributed Systems
 
Computability - Tractable, Intractable and Non-computable Function
Computability - Tractable, Intractable and Non-computable FunctionComputability - Tractable, Intractable and Non-computable Function
Computability - Tractable, Intractable and Non-computable Function
 
Pipeline hazard
Pipeline hazardPipeline hazard
Pipeline hazard
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed system
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
 

Similar to Election algorithms

Synchronization
SynchronizationSynchronization
SynchronizationSara shall
 
Advanced os 5th unit
Advanced os 5th unitAdvanced os 5th unit
Advanced os 5th unitMujtaba Ahmed
 
Synchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptxSynchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptxRichardMathengeSPASP
 
[Yu cheng lin]cloud presentation - Raft
[Yu cheng lin]cloud presentation - Raft[Yu cheng lin]cloud presentation - Raft
[Yu cheng lin]cloud presentation - Raftlin yucheng
 
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdfDC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdfLegesseSamuel
 
Leader election approach a comparison and survey
Leader election approach a comparison and surveyLeader election approach a comparison and survey
Leader election approach a comparison and surveyEditor Jacotech
 
Leader Election Approach: A Comparison and Survey
Leader Election Approach: A Comparison and SurveyLeader Election Approach: A Comparison and Survey
Leader Election Approach: A Comparison and SurveyEditor Jacotech
 
Chapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solvingChapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solvingAbdul Shah
 
Chapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptChapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptsirajmohammed35
 
Prediction approach in predicting next user choice
Prediction approach in predicting next user choicePrediction approach in predicting next user choice
Prediction approach in predicting next user choiceHarshit Srivastava
 
Customer Gauge - AIESEC India & CEM
Customer Gauge - AIESEC India & CEMCustomer Gauge - AIESEC India & CEM
Customer Gauge - AIESEC India & CEMarnavsachdev
 
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemoryAgreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemorySHIKHA GAUTAM
 
Automation Rules and Drip Programs
Automation Rules and Drip ProgramsAutomation Rules and Drip Programs
Automation Rules and Drip ProgramsChris Heiden
 
Modified Bully Algorithm Incorporating the Concept of Election Commissio...
Modified  Bully  Algorithm  Incorporating  the  Concept of Election Commissio...Modified  Bully  Algorithm  Incorporating  the  Concept of Election Commissio...
Modified Bully Algorithm Incorporating the Concept of Election Commissio...Conference-Proceedings-CrimsonPublishers
 
Synchronization - Election Algorithms
Synchronization  - Election AlgorithmsSynchronization  - Election Algorithms
Synchronization - Election AlgorithmsOsaMa Hasan
 
Process Scheduling
Process SchedulingProcess Scheduling
Process SchedulingSanthi thi
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systemsguest61205606
 

Similar to Election algorithms (20)

Synchronization
SynchronizationSynchronization
Synchronization
 
Advanced os 5th unit
Advanced os 5th unitAdvanced os 5th unit
Advanced os 5th unit
 
Synchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptxSynchronization in Distributed Systems.pptx
Synchronization in Distributed Systems.pptx
 
[Yu cheng lin]cloud presentation - Raft
[Yu cheng lin]cloud presentation - Raft[Yu cheng lin]cloud presentation - Raft
[Yu cheng lin]cloud presentation - Raft
 
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdfDC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
DC Lecture 04 and 05 Mutual Excution and Election Algorithms.pdf
 
Leader election approach a comparison and survey
Leader election approach a comparison and surveyLeader election approach a comparison and survey
Leader election approach a comparison and survey
 
Leader Election Approach: A Comparison and Survey
Leader Election Approach: A Comparison and SurveyLeader Election Approach: A Comparison and Survey
Leader Election Approach: A Comparison and Survey
 
Chapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solvingChapter #1 overview of programming and problem solving
Chapter #1 overview of programming and problem solving
 
Chapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.pptChapter 5-Synchronozation.ppt
Chapter 5-Synchronozation.ppt
 
Prediction approach in predicting next user choice
Prediction approach in predicting next user choicePrediction approach in predicting next user choice
Prediction approach in predicting next user choice
 
Customer Gauge - AIESEC India & CEM
Customer Gauge - AIESEC India & CEMCustomer Gauge - AIESEC India & CEM
Customer Gauge - AIESEC India & CEM
 
Agreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared MemoryAgreement Protocols, distributed File Systems, Distributed Shared Memory
Agreement Protocols, distributed File Systems, Distributed Shared Memory
 
Automation Rules and Drip Programs
Automation Rules and Drip ProgramsAutomation Rules and Drip Programs
Automation Rules and Drip Programs
 
Distributed System
Distributed System Distributed System
Distributed System
 
Modified Bully Algorithm Incorporating the Concept of Election Commissio...
Modified  Bully  Algorithm  Incorporating  the  Concept of Election Commissio...Modified  Bully  Algorithm  Incorporating  the  Concept of Election Commissio...
Modified Bully Algorithm Incorporating the Concept of Election Commissio...
 
12EASApril-3412
12EASApril-341212EASApril-3412
12EASApril-3412
 
Synchronization - Election Algorithms
Synchronization  - Election AlgorithmsSynchronization  - Election Algorithms
Synchronization - Election Algorithms
 
Process Scheduling
Process SchedulingProcess Scheduling
Process Scheduling
 
Montali: Declarative, Constraint-Based Business Process Management - Seville ...
Montali: Declarative, Constraint-Based Business Process Management - Seville ...Montali: Declarative, Constraint-Based Business Process Management - Seville ...
Montali: Declarative, Constraint-Based Business Process Management - Seville ...
 
Communication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed SystemsCommunication And Synchronization In Distributed Systems
Communication And Synchronization In Distributed Systems
 

Recently uploaded

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfmbmh111980
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAlluxio, Inc.
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Krakówbim.edu.pl
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareinfo611746
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)Max Lee
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring SoftwareMera Monitor
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfVictor Lopez
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzisteffenkarlsson2
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationWave PLM
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfkalichargn70th171
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesNeo4j
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabbereGrabber
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandIES VE
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationHelp Desk Migration
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockSkilrock Technologies
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...rajkumar669520
 

Recently uploaded (20)

Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdfMastering Windows 7 A Comprehensive Guide for Power Users .pdf
Mastering Windows 7 A Comprehensive Guide for Power Users .pdf
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)JustNaik Solution Deck (stage bus sector)
JustNaik Solution Deck (stage bus sector)
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
Benefits of Employee Monitoring Software
Benefits of  Employee Monitoring SoftwareBenefits of  Employee Monitoring Software
Benefits of Employee Monitoring Software
 
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdfImplementing KPIs and Right Metrics for Agile Delivery Teams.pdf
Implementing KPIs and Right Metrics for Agile Delivery Teams.pdf
 
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with StrimziStrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
StrimziCon 2024 - Transition to Apache Kafka on Kubernetes with Strimzi
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product UpdatesGraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
GraphSummit Stockholm - Neo4j - Knowledge Graphs and Product Updates
 
How to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabberHow to install and activate eGrabber JobGrabber
How to install and activate eGrabber JobGrabber
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
A Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data MigrationA Guideline to Gorgias to to Re:amaze Data Migration
A Guideline to Gorgias to to Re:amaze Data Migration
 
iGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by SkilrockiGaming Platform & Lottery Solutions by Skilrock
iGaming Platform & Lottery Solutions by Skilrock
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
Facemoji Keyboard released its 2023 State of Emoji report, outlining the most...
 

Election algorithms

  • 1. SCHOOL OF ENGINEERING & TECHNOLOGY | ADAMAS UNIVERSITY | KOLKATA Election Algorithms Presented by, Sayan Ghosh M.Tech(CSE)
  • 2. Outline • Election Algorithms ➔ Introduction • Traditional Election Algorithms ➔ Bully Algorithm ➔ Ring Algorithm
  • 3. Need of a Coordinator • Many algorithms used in distributed systems require a coordinator. • In general, all processes in the distributed system are equally suitable for the role of an coordinator. • Election algorithms are designed to choose a coordinator.
  • 4. Election Algorithms Election algorithms choose a process from group of processors to act as a coordinator. If the coordinator process crashes due to some reasons, then a new coordinator is elected on other processor. Election algorithm basically determines where a new copy of coordinator should be restarted. Election algorithm assumes that every active process in the system has a unique priority number. The process with highest priority will be chosen as a new coordinator. Hence, when a coordinator fails, this algorithm elects that active process which has highest priority number.Then this number is send to every active process in the system.
  • 5. Contd. • Every node has a unique id(i.e. process no). • Every process need to know their respective id numbers. • The process with the highest id no will be the coordinator.
  • 6. Bully Algorithm • When a process notices that the coordinator is no longer responding to requests, it initiates an election. • 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.If a process can get an ELECTION message from one of its lower-numbered colleagues. Message arrives to 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.
  • 7. Contd. • Eventually, all processes give up but one, and that one is the new coordinator. • It announces its victory by sending all processes a message telling them that starting immediately it is the new coordinator. • If a process that was previously down comes back up, it holds an election. • If it happens to be the highest-numbered process currently running, it will win the election and take over the coordinator's job. • Thus the biggest guy in town always wins, hence the name "bully
  • 9. Contd. • The group consists of 8 processes. Previously process 7 was the coordinator, but it has just crashed. • Process 4 is the first one to notice this, so it sends ELECTION messages to all the processes higher than it, namely Processes 5 and 6 both respond with OK. • Upon getting the first of these responses, 4 knows that its job is over. „ Both 5 and 6 hold elections, each one only sending messages to those processes higher than itself. • Process 6 tells 5 that it will take over. „6 knows that 7 is dead and that it is the winner.
  • 10. Contd. • 6 announces this by sending a COORDINATOR message to all running processes. • When 4 gets this message, it can now continue with the operation it was trying to do when it discovered that 7 was dead, but using 6 as the coordinator this time. • If process 7 is ever restarted, it will just send all the others a COORDINATOR message and bully them into submission.
  • 11. Ring Algorithm Based on the use of a ring. • Assume: the processes are physically or logically ordered, so that each process knows who its successor is. • When any 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.
  • 12. Contd. • At each step, the sender adds its own process number to the list in the message. • 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. • At that point, the message type is changed to COORDINATOR and circulated once again, this time to inform everyone else who the coordinator is (the list member with the highest number) and who the members of the new ring are. • When this message has circulated once, everyone goes back to work.
  • 13. Example ● When the message returns to p, it sees its own process ID in the list and knows that the circuit is complete. ● P circulates a COORDINATOR message with the new high number. Here, both 2 and 5 elect 6: [5,6,0,1,2,3,4] [2,3,4,5,6,0,1]
  • 14. Contd. • Two processes, 2 and 5, discover simultaneously that the previous coordinator, process 7, has crashed. • Each of these builds an ELECTION message and starts circulating it. • Eventually, both messages will go all the way around, and both 2 and 5 will convert them into COORDINATOR messages, with exactly the same members and in the same order. • When both have gone around again, both will be removed. • It does no harm to have extra messages circulating – at most it wastes a little bandwidth