SlideShare une entreprise Scribd logo
1  sur  22
Election Algorithms
          and
Distributed Processing
      Section 6.5
Outline
• Election algorithms – introduction
• Traditional election algorithms
  – Bully algorithm
  – Ring algorithm
• Wireless election algorithms
Need for a Coordinator
• Many algorithms used in distributed
  systems require a coordinator
  – For example, see the centralized mutual
    exclusion algorithm.
• In general, all processes in the distributed
  system are equally suitable for the role
• Election algorithms are designed to
  choose a coordinator.
Election Algorithms
• Any process can serve as coordinator
• Any process can “call an election” (initiate
  the algorithm to choose a new
  coordinator).
  – There is no harm (other than extra message
    traffic) in having multiple concurrent elections.
• Elections may be needed when the
  system is initialized, or if the coordinator
  crashes or retires.
Assumptions
• Every process/site has a unique ID; e.g.
  – the network address
  – a process number
• Every process in the system should know the
  values in the set of ID numbers, although not
  which processors are up or down.
• The process with the highest ID number will
  be the new coordinator.
• Process groups (as with ISIS toolkit or MPI)
  satisfy these requirements.
Requirements
• When the election algorithm terminates a
  single process has been selected and
  every process knows its identity.
• Formalize: every process pi has a variable
  ei to hold the coordinator’s process
  number.
  – ∀i, ei = undefined or ei = P, where P is the
    non-crashed process with highest id
  – All processes (that have not crashed)
    eventually set ei = P.
The Bully Algorithm - Overview
• Process p calls an election when it notices
  that the coordinator is no longer
  responding.
• High-numbered processes “bully” low-
  numbered processes out of the election,
  until only one process remains.
• When a crashed process reboots, it holds
  an election. If it is now the highest-
  numbered live process, it will win.
Figure 6-20
           1                              1
                    5                              5
    2                                 2
         election                         OK
                            6                              6
4           election                          OK
                                 4
        election
                        3                              3
    0                                 0
               7                          7


    Process p sends an election message to all
    higher-numbered processes in the system.
    If no process responds, then p becomes the
    coordinator.
    If a higher-level process (q) responds, it sends p a
    message that terminates p’s role in the algorithm
The process q now calls an election (if
                                                                         1
it has not already done so).                                                        5
                                                            2                    election
Repeat until no higher-level process
responds. The last process to call an                                                   6
                                                            4
election “wins” the election.                                           election
                                                                                    election
The winner sends a message to other
                                                                0                       3
processes announcing itself as the new                                       7
coordinator.
              1                       Figure 6-20
                     5                                          1
          2                      OK                                          5
                                                    2

      4                      6                          coordinator                6
                                                    4

          0              3                                                   3
                                                        0
              7                                                     7

                  If 7 comes back on line, it will call an election
1                                            1                                         1
                       5                                         5                                           5
    2                                          2                                     2                    election
         election                                       OK
                               6                                         6                                       6
4           election                                        OK                       4
                                       4                                                         election
        election                                                                                             election
                           3                                         3                                           3
    0                                          0                                         0
               7                                        7                                             7


                                   1
                                       5                                                 1
                   2                               OK                                                 5
                                                                             2

               4                               6                                 coordinator                6
                                                                             4

                   0                       3                                                          3
                                                                                 0
                                   7                                                         7
                                                                 Figure 6-20
Analysis
• Works best if communication in the system
  has bounded latency so processes can
  determine that a process has failed by
  knowing the upper bound (UB) on
  message transmission time (T) and
  message processing time (M).
  – UB = 2 * T + M
• However, if a process calls an election
  when the coordinator is still active, the
  coordinator will win the election.
A Ring Algorithm - Overview
• The ring algorithm assumes that the
  processes are arranged in a logical ring
  and each process is knows the order of
  the ring of processes.
• Processes are able to “skip” faulty
  systems: instead of sending to process
  j, send to j + 1.
• Faulty systems are those that don’t
  respond in a fixed amount of time.
A Ring Algorithm
• P thinks the coordinator has crashed;
  builds an ELECTION message which
  contains its own ID number.
• Sends to first live successor
• Each process adds its
  own number and
  forwards to next.
• OK to have two
  elections at once.
Ring Algorithm - Details
• 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]
Elections in Wireless Environments
• Traditional algorithms aren’t appropriate.
  – Can’t assume reliable message passing or
    stable network configuration
• This discussion focuses on ad hoc
  wireless networks but ignores node
  mobility.
  – Nodes connect directly, no common access
    point, connection is short term
  – Often used in multiplayer gaming, on-the-fly
    file transfers, etc.
Assumptions
• Wireless algorithms try to find the best node
  to be coordinator; traditional algorithms are
  satisfied with any node.
• Any node (the source) can initiate an
  election by sending an ELECTION message
  to its neighbors – nodes within range.
• When a node receives its first ELECTION
  message the sender becomes its parent
  node.
Figure 6-22.




• Node a is the source.
  Messages have a unique ID to manage possible
  concurrent elections
Figure 6.22




• Figure 6-22. Election algorithm in a
  wireless network, with node a as the
  source. (a) Initial network. (b)–(e) The
  build-tree phase

When a node R receives its first election message,
it designates the source Q as its parent, and
forwards the message to all neighbors except Q.
When R receives an election message from a non-
parent, it just acknowledges the message
• Figure 6-22. (e) The build-tree phase.
   (f) Reporting of best node to source.


If R’s neighbors have parents, R is a leaf; otherwise it
waits for its children to forward the message to their
neighbors.
When R has collected acks from all its neighbors, it
acknowledges the message from Q.
Acknowledgements flow back up the tree to the
original source.
Wireless Elections
• At each stage the “most eligible” or “best”
  node will be passed along from child to
  parent.
• Once the source node has received all the
  replies, it is in a position to choose the
  new coordinator.
• When the selection is made, it is
  broadcast to all nodes in the network.
Wireless Elections
• If more than one election is called (multiple
  source nodes), a node should participate in only
  one.
• Election messages are tagged with a process id.
• If a node has chosen a parent but gets an
  election message from a higher numbered
  node, it drops out of the current election and
  adopts the high numbered node as its parent.
  This ensures only one election makes a choice.
Chapter 6 - Summary
• “Synchronization is … doing the right thing
  at the right time.”
• Synchronization in distributed systems is
  related to communication.
• Complicated by lack of global clock,
  shared memory.
• Logical clocks support global event order.
• Distributed mutex: important class of
  synchronization algorithms.
• Leader election algorithms are sometimes
  needed.

Contenu connexe

Tendances

8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back trackingTech_MX
 
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
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure callSunita Sahu
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical ClocksDilum Bandara
 
Network layer - design Issues
Network layer - design IssuesNetwork layer - design Issues
Network layer - design Issuesقصي نسور
 
Corba concepts & corba architecture
Corba concepts & corba architectureCorba concepts & corba architecture
Corba concepts & corba architecturenupurmakhija1211
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemPoojaBele1
 
Security in distributed systems
Security in distributed systems Security in distributed systems
Security in distributed systems Haitham Ahmed
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process CommunicationAdeel Rasheed
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating SystemsRitu Ranjan Shrivastwa
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented CommunicationDilum Bandara
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating systemudaya khanal
 
Design Goals of Distributed System
Design Goals of Distributed SystemDesign Goals of Distributed System
Design Goals of Distributed SystemAshish KC
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptxAcad
 

Tendances (20)

8 queens problem using back tracking
8 queens problem using back tracking8 queens problem using back tracking
8 queens problem using back tracking
 
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
 
RPC: Remote procedure call
RPC: Remote procedure callRPC: Remote procedure call
RPC: Remote procedure call
 
Physical and Logical Clocks
Physical and Logical ClocksPhysical and Logical Clocks
Physical and Logical Clocks
 
Groupware
GroupwareGroupware
Groupware
 
Network layer - design Issues
Network layer - design IssuesNetwork layer - design Issues
Network layer - design Issues
 
Corba concepts & corba architecture
Corba concepts & corba architectureCorba concepts & corba architecture
Corba concepts & corba architecture
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
Security in distributed systems
Security in distributed systems Security in distributed systems
Security in distributed systems
 
Stream oriented communication
Stream oriented communicationStream oriented communication
Stream oriented communication
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
Spline representations
Spline representationsSpline representations
Spline representations
 
Process synchronization in Operating Systems
Process synchronization in Operating SystemsProcess synchronization in Operating Systems
Process synchronization in Operating Systems
 
Distributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithmsDistributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithms
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
Message and Stream Oriented Communication
Message and Stream Oriented CommunicationMessage and Stream Oriented Communication
Message and Stream Oriented Communication
 
Distributed operating system
Distributed operating systemDistributed operating system
Distributed operating system
 
Ddbms1
Ddbms1Ddbms1
Ddbms1
 
Design Goals of Distributed System
Design Goals of Distributed SystemDesign Goals of Distributed System
Design Goals of Distributed System
 
Network Layer design Issues.pptx
Network Layer design Issues.pptxNetwork Layer design Issues.pptx
Network Layer design Issues.pptx
 

Plus de Ankush Kumar

Introduction to soft computing
Introduction to soft computingIntroduction to soft computing
Introduction to soft computingAnkush Kumar
 
3. planning in situational calculas
3. planning in situational calculas3. planning in situational calculas
3. planning in situational calculasAnkush Kumar
 
Cause effect graphing technique
Cause effect graphing techniqueCause effect graphing technique
Cause effect graphing techniqueAnkush Kumar
 

Plus de Ankush Kumar (6)

Introduction to soft computing
Introduction to soft computingIntroduction to soft computing
Introduction to soft computing
 
3. planning in situational calculas
3. planning in situational calculas3. planning in situational calculas
3. planning in situational calculas
 
415212 415212
415212 415212415212 415212
415212 415212
 
Java security
Java securityJava security
Java security
 
Cause effect graphing technique
Cause effect graphing techniqueCause effect graphing technique
Cause effect graphing technique
 
Inferno
InfernoInferno
Inferno
 

Dernier

TDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s Leadership
TDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s LeadershipTDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s Leadership
TDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s Leadershipanjanibaddipudi1
 
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopkoEmbed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopkobhavenpr
 
如何办理(BU学位证书)美国贝翰文大学毕业证学位证书
如何办理(BU学位证书)美国贝翰文大学毕业证学位证书如何办理(BU学位证书)美国贝翰文大学毕业证学位证书
如何办理(BU学位证书)美国贝翰文大学毕业证学位证书Fi L
 
30042024_First India Newspaper Jaipur.pdf
30042024_First India Newspaper Jaipur.pdf30042024_First India Newspaper Jaipur.pdf
30042024_First India Newspaper Jaipur.pdfFIRST INDIA
 
Vashi Escorts, {Pooja 09892124323}, Vashi Call Girls
Vashi Escorts, {Pooja 09892124323}, Vashi Call GirlsVashi Escorts, {Pooja 09892124323}, Vashi Call Girls
Vashi Escorts, {Pooja 09892124323}, Vashi Call GirlsPooja Nehwal
 
Nara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's Development
Nara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's DevelopmentNara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's Development
Nara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's Developmentnarsireddynannuri1
 
2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx
2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx
2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docxkfjstone13
 
Israel Palestine Conflict, The issue and historical context!
Israel Palestine Conflict, The issue and historical context!Israel Palestine Conflict, The issue and historical context!
Israel Palestine Conflict, The issue and historical context!Krish109503
 
Enjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort ServiceDelhi Call girls
 
Enjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...
HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...
HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...Ismail Fahmi
 
Powerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 
29042024_First India Newspaper Jaipur.pdf
29042024_First India Newspaper Jaipur.pdf29042024_First India Newspaper Jaipur.pdf
29042024_First India Newspaper Jaipur.pdfFIRST INDIA
 
Pakistan PMLN Election Manifesto 2024.pdf
Pakistan PMLN Election Manifesto 2024.pdfPakistan PMLN Election Manifesto 2024.pdf
Pakistan PMLN Election Manifesto 2024.pdfFahimUddin61
 
Kishan Reddy Report To People (2019-24).pdf
Kishan Reddy Report To People (2019-24).pdfKishan Reddy Report To People (2019-24).pdf
Kishan Reddy Report To People (2019-24).pdfKISHAN REDDY OFFICE
 
Lorenzo D'Emidio_Lavoro sullaNorth Korea .pptx
Lorenzo D'Emidio_Lavoro sullaNorth Korea .pptxLorenzo D'Emidio_Lavoro sullaNorth Korea .pptx
Lorenzo D'Emidio_Lavoro sullaNorth Korea .pptxlorenzodemidio01
 
2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx
2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx
2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docxkfjstone13
 
Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...
Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...
Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...narsireddynannuri1
 
AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...
AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...
AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...Axel Bruns
 
KAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptx
KAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptxKAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptx
KAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptxjohnandrewcarlos
 

Dernier (20)

TDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s Leadership
TDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s LeadershipTDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s Leadership
TDP As the Party of Hope For AP Youth Under N Chandrababu Naidu’s Leadership
 
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopkoEmbed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
Embed-2 (1).pdfb[k[k[[k[kkkpkdpokkdpkopko
 
如何办理(BU学位证书)美国贝翰文大学毕业证学位证书
如何办理(BU学位证书)美国贝翰文大学毕业证学位证书如何办理(BU学位证书)美国贝翰文大学毕业证学位证书
如何办理(BU学位证书)美国贝翰文大学毕业证学位证书
 
30042024_First India Newspaper Jaipur.pdf
30042024_First India Newspaper Jaipur.pdf30042024_First India Newspaper Jaipur.pdf
30042024_First India Newspaper Jaipur.pdf
 
Vashi Escorts, {Pooja 09892124323}, Vashi Call Girls
Vashi Escorts, {Pooja 09892124323}, Vashi Call GirlsVashi Escorts, {Pooja 09892124323}, Vashi Call Girls
Vashi Escorts, {Pooja 09892124323}, Vashi Call Girls
 
Nara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's Development
Nara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's DevelopmentNara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's Development
Nara Chandrababu Naidu's Visionary Policies For Andhra Pradesh's Development
 
2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx
2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx
2024 04 03 AZ GOP LD4 Gen Meeting Minutes FINAL.docx
 
Israel Palestine Conflict, The issue and historical context!
Israel Palestine Conflict, The issue and historical context!Israel Palestine Conflict, The issue and historical context!
Israel Palestine Conflict, The issue and historical context!
 
Enjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Iffco Chowk Gurgaon >༒8448380779 Escort Service
 
Enjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Rajokri Delhi >༒8448380779 Escort Service
 
HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...
HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...
HARNESSING AI FOR ENHANCED MEDIA ANALYSIS A CASE STUDY ON CHATGPT AT DRONE EM...
 
Powerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Phoenix, AZ (310) 882-6330 Bring Back Lost Lover
 
29042024_First India Newspaper Jaipur.pdf
29042024_First India Newspaper Jaipur.pdf29042024_First India Newspaper Jaipur.pdf
29042024_First India Newspaper Jaipur.pdf
 
Pakistan PMLN Election Manifesto 2024.pdf
Pakistan PMLN Election Manifesto 2024.pdfPakistan PMLN Election Manifesto 2024.pdf
Pakistan PMLN Election Manifesto 2024.pdf
 
Kishan Reddy Report To People (2019-24).pdf
Kishan Reddy Report To People (2019-24).pdfKishan Reddy Report To People (2019-24).pdf
Kishan Reddy Report To People (2019-24).pdf
 
Lorenzo D'Emidio_Lavoro sullaNorth Korea .pptx
Lorenzo D'Emidio_Lavoro sullaNorth Korea .pptxLorenzo D'Emidio_Lavoro sullaNorth Korea .pptx
Lorenzo D'Emidio_Lavoro sullaNorth Korea .pptx
 
2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx
2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx
2024 03 13 AZ GOP LD4 Gen Meeting Minutes_FINAL.docx
 
Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...
Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...
Nurturing Families, Empowering Lives: TDP's Vision for Family Welfare in Andh...
 
AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...
AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...
AI as Research Assistant: Upscaling Content Analysis to Identify Patterns of ...
 
KAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptx
KAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptxKAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptx
KAHULUGAN AT KAHALAGAHAN NG GAWAING PANSIBIKO.pptx
 

Election algorithms

  • 1. Election Algorithms and Distributed Processing Section 6.5
  • 2. Outline • Election algorithms – introduction • Traditional election algorithms – Bully algorithm – Ring algorithm • Wireless election algorithms
  • 3. Need for a Coordinator • Many algorithms used in distributed systems require a coordinator – For example, see the centralized mutual exclusion algorithm. • In general, all processes in the distributed system are equally suitable for the role • Election algorithms are designed to choose a coordinator.
  • 4. Election Algorithms • Any process can serve as coordinator • Any process can “call an election” (initiate the algorithm to choose a new coordinator). – There is no harm (other than extra message traffic) in having multiple concurrent elections. • Elections may be needed when the system is initialized, or if the coordinator crashes or retires.
  • 5. Assumptions • Every process/site has a unique ID; e.g. – the network address – a process number • Every process in the system should know the values in the set of ID numbers, although not which processors are up or down. • The process with the highest ID number will be the new coordinator. • Process groups (as with ISIS toolkit or MPI) satisfy these requirements.
  • 6. Requirements • When the election algorithm terminates a single process has been selected and every process knows its identity. • Formalize: every process pi has a variable ei to hold the coordinator’s process number. – ∀i, ei = undefined or ei = P, where P is the non-crashed process with highest id – All processes (that have not crashed) eventually set ei = P.
  • 7. The Bully Algorithm - Overview • Process p calls an election when it notices that the coordinator is no longer responding. • High-numbered processes “bully” low- numbered processes out of the election, until only one process remains. • When a crashed process reboots, it holds an election. If it is now the highest- numbered live process, it will win.
  • 8. Figure 6-20 1 1 5 5 2 2 election OK 6 6 4 election OK 4 election 3 3 0 0 7 7 Process p sends an election message to all higher-numbered processes in the system. If no process responds, then p becomes the coordinator. If a higher-level process (q) responds, it sends p a message that terminates p’s role in the algorithm
  • 9. The process q now calls an election (if 1 it has not already done so). 5 2 election Repeat until no higher-level process responds. The last process to call an 6 4 election “wins” the election. election election The winner sends a message to other 0 3 processes announcing itself as the new 7 coordinator. 1 Figure 6-20 5 1 2 OK 5 2 4 6 coordinator 6 4 0 3 3 0 7 7 If 7 comes back on line, it will call an election
  • 10. 1 1 1 5 5 5 2 2 2 election election OK 6 6 6 4 election OK 4 4 election election election 3 3 3 0 0 0 7 7 7 1 5 1 2 OK 5 2 4 6 coordinator 6 4 0 3 3 0 7 7 Figure 6-20
  • 11. Analysis • Works best if communication in the system has bounded latency so processes can determine that a process has failed by knowing the upper bound (UB) on message transmission time (T) and message processing time (M). – UB = 2 * T + M • However, if a process calls an election when the coordinator is still active, the coordinator will win the election.
  • 12. A Ring Algorithm - Overview • The ring algorithm assumes that the processes are arranged in a logical ring and each process is knows the order of the ring of processes. • Processes are able to “skip” faulty systems: instead of sending to process j, send to j + 1. • Faulty systems are those that don’t respond in a fixed amount of time.
  • 13. A Ring Algorithm • P thinks the coordinator has crashed; builds an ELECTION message which contains its own ID number. • Sends to first live successor • Each process adds its own number and forwards to next. • OK to have two elections at once.
  • 14. Ring Algorithm - Details • 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]
  • 15. Elections in Wireless Environments • Traditional algorithms aren’t appropriate. – Can’t assume reliable message passing or stable network configuration • This discussion focuses on ad hoc wireless networks but ignores node mobility. – Nodes connect directly, no common access point, connection is short term – Often used in multiplayer gaming, on-the-fly file transfers, etc.
  • 16. Assumptions • Wireless algorithms try to find the best node to be coordinator; traditional algorithms are satisfied with any node. • Any node (the source) can initiate an election by sending an ELECTION message to its neighbors – nodes within range. • When a node receives its first ELECTION message the sender becomes its parent node.
  • 17. Figure 6-22. • Node a is the source. Messages have a unique ID to manage possible concurrent elections
  • 18. Figure 6.22 • Figure 6-22. Election algorithm in a wireless network, with node a as the source. (a) Initial network. (b)–(e) The build-tree phase When a node R receives its first election message, it designates the source Q as its parent, and forwards the message to all neighbors except Q. When R receives an election message from a non- parent, it just acknowledges the message
  • 19. • Figure 6-22. (e) The build-tree phase. (f) Reporting of best node to source. If R’s neighbors have parents, R is a leaf; otherwise it waits for its children to forward the message to their neighbors. When R has collected acks from all its neighbors, it acknowledges the message from Q. Acknowledgements flow back up the tree to the original source.
  • 20. Wireless Elections • At each stage the “most eligible” or “best” node will be passed along from child to parent. • Once the source node has received all the replies, it is in a position to choose the new coordinator. • When the selection is made, it is broadcast to all nodes in the network.
  • 21. Wireless Elections • If more than one election is called (multiple source nodes), a node should participate in only one. • Election messages are tagged with a process id. • If a node has chosen a parent but gets an election message from a higher numbered node, it drops out of the current election and adopts the high numbered node as its parent. This ensures only one election makes a choice.
  • 22. Chapter 6 - Summary • “Synchronization is … doing the right thing at the right time.” • Synchronization in distributed systems is related to communication. • Complicated by lack of global clock, shared memory. • Logical clocks support global event order. • Distributed mutex: important class of synchronization algorithms. • Leader election algorithms are sometimes needed.