Docsity

Election Algorithms - Distributed Operating Systems - Lecture Slides, Slides of Operating Systems

Partial preview of the text

Download Election Algorithms - Distributed Operating Systems - Lecture Slides and more Slides Operating Systems in PDF only on Docsity!

Distributed Systems

Election Algorithms

Election Algorithms

  • If we are using one process as a coordinator for a shared resource …
  • …how do we select that one process? 2

Election Algorithms

  • Wired systems
    • Bully algorithm
    • Ring algorithm
  • Wireless systems
  • Very large-scale systems 4

Bully Algorithm

  • Assume
    • All processes know about each other
    • Processes numbered uniquely
    • They do not know each other’s state
  • Suppose P notices no coordinator
    • Sends election message to all higher numbered processes
    • If no response, P takes over as coordinator
    • If any responds, P yields
  • … 5

Bully Algorithm (continued)

7

Bully Algorithm (continued)

  • Suppose R comes back on line
    • Sends a new election message to higher numbered processes
  • Repeat until only one process left standing
    • Announces victory by sending message saying that it is the coordinator (if not already the coordinator)
  • Existing (lower numbered) coordinator yields
    • Hence the term “bully” 8

Alternative – Ring Algorithm

  • Suppose P receives an election message with its own process number in body
    • Changes message to coordinator message, preserving body
    • All processes recognize highest numbered process as new coordinator
  • If multiple messages circulate …
    • …they will all contain same list of processes (eventually)
  • If process comes back on-line
    • Calls new election 10

Ring Algorithm (continued)

11

(a)

(c)

(b)

(d)

Elections in Wireless Environment (e) The build-tree phase. (f) Reporting of best node to source. c c