SlideShare uma empresa Scribd logo
1 de 30
SYNCHRONIZATION
By : Osama Hasan
OUTLINE



 Global Positioning of Nodes
 Election Algorithms
 Elections in Wireless Environments
Global Positioning of Nodes
GLOBAL POSITIONING OF NODES


When the number of nodes in a distributed
system grows, it becomes increasingly
difficult for any node to keep track of the
others. Such knowledge may be important
for executing distributed algorithms such as
routing,           multicasting,        data
placement, searching, and so on.
GLOBAL POSITIONING OF NODES
There are many applications of geometric overlay
networks. Consider the situation where a Web site at
server O has been replicated to multiple servers on
the Internet. When a client C requests a page from
O, the latter may decide to redirect that request to
the server closest to C, give the best response time.
If the geometric location of C is known, as well as
those of each replica server, O can then simply pick
that server ( i.e. ) S, for which d(C,S) is minimal.
There is no need to sample all the latencies between
C and each of the replica servers.
Election Algorithms
ELECTION ALGORITHM
   There are at least two basic strategies by which a
    distributed system can adapt to failures.

       operate continuously as failures occur and are repaired

       The second alternative is to temporarily halt normal
        operation and to take some time out to reorganize the
        system.

             The reorganization of the system is managed by a single node
             called the coordinator.

            So as a first step in any reorganization, the operating or active
             nodes must elect a coordinator.
ELECTION ALGORITHM


   Many algorithms used in distributed systems require
    a coordinator
       For example, 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 ALGORITHM

  Any   process can serve as coordinator
  Any process can “call an election”
   (initiate the algorithm to choose a new
   coordinator).
  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.
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.
ELECTION ALGORITHMS


 The   two classical election algorithms

     Bully Algorithm
     Ring Algorithm
The Bully Algorithm
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.
THE BULLY ALGORITHM

                       1
                                5
                   2
                       OK
                                        6
               4           OK

                                    3
                   0
                           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 BULLY ALGORITHM

The processThe winner sends a message 1
                q now calls an                       5
election (if itto otheralready
                has not processes       2         election OK
done so).      announcing itself as the new
Repeat untilcoordinator.
                no higher-level                           6
                                       4    election
process responds. The last
                                                     election
process to call an election
“wins” the election.                      0               3
                              1
                                        5        7
                      2

                          coordinator       6
                     4


                          0             3
                                  7
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
The Ring Algorithm
THE RING ALGORITHM
 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.
THE 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.
THE RING ALGORITHM
 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
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.
ELECTIONS IN WIRELESS ENVIRONMENTS

 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.
 Node a is the source.
 Messages have a unique ID to manage
 possible concurrent elections
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
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.
ELECTIONS IN WIRELESS ENVIRONMENTS

 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.
ELECTIONS IN WIRELESS ENVIRONMENTS
 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.
Thanks for Listening

Mais conteúdo relacionado

Mais procurados

Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed systemSunita Sahu
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System Harshita Ved
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Chapter 6-Consistency and Replication.ppt
Chapter 6-Consistency and Replication.pptChapter 6-Consistency and Replication.ppt
Chapter 6-Consistency and Replication.pptsirajmohammed35
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 
Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Chandra Meena
 
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
 
Destination Sequenced Distance Vector Routing (DSDV)
Destination Sequenced Distance Vector Routing (DSDV)Destination Sequenced Distance Vector Routing (DSDV)
Destination Sequenced Distance Vector Routing (DSDV)ArunChokkalingam
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed SystemsNandakumar P
 
Distributed transaction
Distributed transactionDistributed transaction
Distributed transactionMohitKothari26
 
Join ordering in fragment queries
Join ordering in fragment queriesJoin ordering in fragment queries
Join ordering in fragment queriesIfzalhussainkhan
 
Election in Wireless Environment
Election in Wireless EnvironmentElection in Wireless Environment
Election in Wireless EnvironmentLahiru Danushka
 
Election algorithms
Election algorithmsElection algorithms
Election algorithmsAnkush Kumar
 

Mais procurados (20)

Distributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithmsDistributed Mutual exclusion algorithms
Distributed Mutual exclusion algorithms
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed system
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
clock synchronization in Distributed System
clock synchronization in Distributed System clock synchronization in Distributed System
clock synchronization in Distributed System
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Chapter 6-Consistency and Replication.ppt
Chapter 6-Consistency and Replication.pptChapter 6-Consistency and Replication.ppt
Chapter 6-Consistency and Replication.ppt
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
CS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMSCS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMS
 
Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc Lecture 19 22. transport protocol for ad-hoc
Lecture 19 22. transport protocol for ad-hoc
 
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
 
Destination Sequenced Distance Vector Routing (DSDV)
Destination Sequenced Distance Vector Routing (DSDV)Destination Sequenced Distance Vector Routing (DSDV)
Destination Sequenced Distance Vector Routing (DSDV)
 
Synch
SynchSynch
Synch
 
Naming in Distributed Systems
Naming in Distributed SystemsNaming in Distributed Systems
Naming in Distributed Systems
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Distributed transaction
Distributed transactionDistributed transaction
Distributed transaction
 
Join ordering in fragment queries
Join ordering in fragment queriesJoin ordering in fragment queries
Join ordering in fragment queries
 
Global state routing
Global state routingGlobal state routing
Global state routing
 
Election in Wireless Environment
Election in Wireless EnvironmentElection in Wireless Environment
Election in Wireless Environment
 
Election algorithms
Election algorithmsElection algorithms
Election algorithms
 
Semi join
Semi joinSemi join
Semi join
 

Último

Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptxFIDO Alliance
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...FIDO Alliance
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightSafe Software
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideStefan Dietze
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxFIDO Alliance
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdfMuhammad Subhan
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxFIDO Alliance
 

Último (20)

Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider  Progress from Awareness to Implementation.pptxTales from a Passkey Provider  Progress from Awareness to Implementation.pptx
Tales from a Passkey Provider Progress from Awareness to Implementation.pptx
 
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...Hyatt driving innovation and exceptional customer experiences with FIDO passw...
Hyatt driving innovation and exceptional customer experiences with FIDO passw...
 
The Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and InsightThe Zero-ETL Approach: Enhancing Data Agility and Insight
The Zero-ETL Approach: Enhancing Data Agility and Insight
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
“Iamnobody89757” Understanding the Mysterious of Digital Identity.pdf
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 

Synchronization - Election Algorithms

  • 2. OUTLINE  Global Positioning of Nodes  Election Algorithms  Elections in Wireless Environments
  • 4. GLOBAL POSITIONING OF NODES When the number of nodes in a distributed system grows, it becomes increasingly difficult for any node to keep track of the others. Such knowledge may be important for executing distributed algorithms such as routing, multicasting, data placement, searching, and so on.
  • 5. GLOBAL POSITIONING OF NODES There are many applications of geometric overlay networks. Consider the situation where a Web site at server O has been replicated to multiple servers on the Internet. When a client C requests a page from O, the latter may decide to redirect that request to the server closest to C, give the best response time. If the geometric location of C is known, as well as those of each replica server, O can then simply pick that server ( i.e. ) S, for which d(C,S) is minimal. There is no need to sample all the latencies between C and each of the replica servers.
  • 7. ELECTION ALGORITHM  There are at least two basic strategies by which a distributed system can adapt to failures.  operate continuously as failures occur and are repaired  The second alternative is to temporarily halt normal operation and to take some time out to reorganize the system.  The reorganization of the system is managed by a single node called the coordinator.  So as a first step in any reorganization, the operating or active nodes must elect a coordinator.
  • 8. ELECTION ALGORITHM  Many algorithms used in distributed systems require a coordinator  For example, 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.
  • 9. ELECTION ALGORITHM  Any process can serve as coordinator  Any process can “call an election” (initiate the algorithm to choose a new coordinator).  Elections may be needed when the system is initialized, or if the coordinator crashes or retires.
  • 10. 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.
  • 11. 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.
  • 12. ELECTION ALGORITHMS  The two classical election algorithms  Bully Algorithm  Ring Algorithm
  • 14. 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.
  • 15. THE BULLY ALGORITHM 1 5 2 OK 6 4 OK 3 0 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
  • 16. THE BULLY ALGORITHM The processThe winner sends a message 1 q now calls an 5 election (if itto otheralready has not processes 2 election OK done so). announcing itself as the new Repeat untilcoordinator. no higher-level 6 4 election process responds. The last election process to call an election “wins” the election. 0 3 1 5 7 2 coordinator 6 4 0 3 7
  • 17. 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
  • 19. THE RING ALGORITHM  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.
  • 20. THE 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.
  • 21. THE RING ALGORITHM  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]
  • 22. Elections in Wireless Environments
  • 23. 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.
  • 24. ELECTIONS IN WIRELESS ENVIRONMENTS  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.
  • 25.  Node a is the source. Messages have a unique ID to manage possible concurrent elections
  • 26. 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
  • 27. 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.
  • 28. ELECTIONS IN WIRELESS ENVIRONMENTS  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.
  • 29. ELECTIONS IN WIRELESS ENVIRONMENTS  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.