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

distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
Ashish Kumar
 

Mais procurados (20)

Dist deadlock sureka
Dist deadlock surekaDist deadlock sureka
Dist deadlock sureka
 
Clock synchronization in distributed system
Clock synchronization in distributed systemClock synchronization in distributed system
Clock synchronization in distributed system
 
Message passing in Distributed Computing Systems
Message passing in Distributed Computing SystemsMessage passing in Distributed Computing Systems
Message passing in Distributed Computing Systems
 
Distributed Operating System
Distributed Operating SystemDistributed Operating System
Distributed Operating System
 
Gsm radio-interface
Gsm radio-interfaceGsm radio-interface
Gsm radio-interface
 
CS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMSCS6601 DISTRIBUTED SYSTEMS
CS6601 DISTRIBUTED SYSTEMS
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
Remote Procedure Call in Distributed System
Remote Procedure Call in Distributed SystemRemote Procedure Call in Distributed System
Remote Procedure Call in Distributed System
 
Routing protocols
Routing protocolsRouting protocols
Routing protocols
 
Zone Routing Protocol
Zone Routing ProtocolZone Routing Protocol
Zone Routing Protocol
 
Replication in Distributed Systems
Replication in Distributed SystemsReplication in Distributed Systems
Replication in Distributed Systems
 
HDLC and Point to point protocol
HDLC and Point to point protocolHDLC and Point to point protocol
HDLC and Point to point protocol
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 
x.509-Directory Authentication Service
x.509-Directory Authentication Servicex.509-Directory Authentication Service
x.509-Directory Authentication Service
 
Mac protocols of adhoc network
Mac protocols of adhoc networkMac protocols of adhoc network
Mac protocols of adhoc network
 
Multiple Access Protocal
Multiple Access ProtocalMultiple Access Protocal
Multiple Access Protocal
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
QOS (Quality of Services) - Computer Networks
 QOS (Quality of Services) - Computer Networks QOS (Quality of Services) - Computer Networks
QOS (Quality of Services) - Computer Networks
 
Routing Protocols
Routing Protocols Routing Protocols
Routing Protocols
 
Distributed process and scheduling
Distributed process and scheduling Distributed process and scheduling
Distributed process and scheduling
 

Último

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

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.