1 / 16

Synchronization II

Synchronization II. CSE5306 Lecture Quiz 17 due at 5 PM Tuesday, 7 October 2014. 6.3.5 A Token Ring Algorithm. A token ring network can make a resource mutually exclusive. A token circulates around the ring till a needy process can briefly hold it, while using the resource.

Download Presentation

Synchronization II

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Synchronization II CSE5306 Lecture Quiz 17 due at 5 PM Tuesday, 7 October 2014

  2. 6.3.5 A Token Ring Algorithm • A token ring network can make a resource mutually exclusive. • A token circulates around the ring till a needy process can briefly hold it, while using the resource. • The protocol is simple, fast, and it never starves a process. When a crashed process cannot acknowledge its token passing message, the sender throws the token over it to the next process. • But the token can be lost when its holder crashes, and using a simple expiration timer risks the possibility that the holder actually is still using the token.

  3. 6.3.6. Comparing the Algorithms • The centralized algorithm is simple and efficient, requiring only 3 messages to enter and exit a critical region. Assuming brief resource usage, access is delayed by only 2 messages. Crashes can bring down system. • The decentralized algorithm makes k attempts to send/rcv messages to/from m coordinators. Its access delay is 3mk. It is immune to crashes, but starvation and efficiency are problems. • The distributed algorithm sends request and grant messages to its n-1 peers, with access delay 2(n-1). Crashes can bring it down. • The token ring algorithm may waste hours sending token-passing messages, while no one is using the resource. Access delay is from 1 to n-1. Crashes can bring down system.

  4. 6.4 Global Positioning Nodes • Geometric overlay networks organize large numbers of communicating (possibly mobile) nodes by their physical positions: • A client may be redirected to a server’s closest replicate, assuming everyone’s position is known. • Optimal replica placement minimizes average client-to-replica response time. • Position-based routing uses only local information in forwarding messages to waypoints closest to the destination.

  5. Global Positioning (continued) • Contacting three nodes can fix a mobile client’s position, from their measured message latencies, d = √(xi-xp)2+(xi-xp)2, i=1..3 • If inconsistent distances violate the triangle inequality, use only two (landmark) nodes at a time, and minimize their cumulative error. • Or model equal-tension springs from every node to the client.

  6. R U O K ? • Which mutual exclusion algorithm is most reliable? __ • Centralized. • Decentralized. • Distributed. • Token ring.

  7. R U O K ? 2. A client contacts three nearby nodes at (1,2),(2,3) and (3,1), measuring messages latencies of 6, 4 and 2 microseconds. What is the client’s position? __ • (11,3) b. (-11,3) c. (-11,-3) d. (11,-3)

  8. R U O K ? Match the following algorithms with their definitions below. 3. Centralized algorithm. __ 4. Decentralized algorithm. __ 5. Distributed algorithm. __ 6. Token ring algorithm. __ • Others grudgingly grant resource access, if my timestamp is earlier than theirs. • Many replicated resources and their DHT-based coordinators allocated around a Chord ring. • Ask the coordinator process’ permission to use the resource. • Message circulates till a needy process briefly holds it, while using the resource.

  9. R U O K ? Match the following terms with their definitions below. 7. Starved. __ 8. Geometric overlay network. __ 9. Optimal replica placement. __ 10. Position-based routing. __ 11. Triangle inequality. __ 12. Landmarks. __ • Uses only local information in forwarding messages to waypoints closest to the destination. • Many pairs of nodes, which may be used to triangulate position. • A process with reduced access a resource. • Side c < a + b. • Large numbers of communicating (possibly mobile) nodes organized by their physical positions. • Minimizes average client-to-replica response time.

  10. 6.5 Election Algorithms • An election algorithm chooses one of many nodes to serve as coordinator. • All processes know each other’s node identification numbers, but they do not know which nodes are currently active. • Traditionally the bully and ring algorithms were most popular. • Wireless environments and large-scale systems call for more sophistication.

  11. 6.5.1 Traditional Election Algorithms • Bully algorithm: • When node P finds its coordinator is unresponsive, it sends an ELECTION message to all higher numbered nodes. • Each receiving node answers “OK” and recursively performs steps 1-3. • If nobody answers, P sends a victory (COORDINATOR) message and becomes the new coordinator. • Crashed nodes also hold elections, when they restart. • The name comes from the biggest numbered node always winning.

  12. Traditional Elections (continued) • Ring Algorithm: • When node P finds its coordinator is unresponsive, it circulates an ELECTION message around the ring. • Each receiving node responds and adds its number to the circulating message. • When P receives its own ELECTION message, it circulates a COORDINATOR message around the ring to inform everyone that it is the new coordinator. • If two nodes do this simultaneously, messages circulated by the lower-numbered node will have the last word.

  13. 6.5.2 WiFi Elections • Traditional elections don’t work in wireless networks, where message passing is unreliable and topologies change. WiFi elections choose the best candidate: • A node that receives an ELECTION message for the first time calls the sender its parent. • It Acks its parent’s message, telling its battery life and other resources. • And it relays the parent’s message to its other neighbors. • When other nodes call it their parent and Ack its message, it returns their resource reports to its parent. • Eventually the initiator designates the most resourceful node as their new coordinator. • Each node joins only one of many concurrent elections.

  14. 6.5.3 Large-Scale System Elections • Massive distributed systems elect superpeers: • Low-latency access to normal nodes. • Even distribution across the overlay network. • Predefined ratio to the total number of nodes. • Serve more than a fixed number of normal nodes. • In structured DHT-based systems, we can identify a superpeer as number 11100000 and its nodes as 111ΦΦΦΦΦ, where Φ=don’t care. • In unstructured gossip-based systems, we can randomly distribute tokens. The tokens repel each other, such that each token forces nearby tokens away. Every token eventually settles on a superpeer.

  15. 6.6 Summary • Synchronization causes communicating processes to “do the right thing at the right time,” without a globally shared clock. • Processes synchronize clocks by exchanging clock values and accounting for propagation delays. • Latencies can be estimated from separation distances. • Lamport showed that ordering is more important than real time. His timestamps extend to vector timestamps that order events by causality. • A coordinator can ensure a resource’s mutual exclusion; i.e., only one process’ access at a time. • Election algorithms safely replace crashed coordinators and select superpeers.

  16. R U O K ? Match the following election algorithms with their definitions below. 13. Bully. __ 14. Ring. __ 15. WiFi. __ 16. Superpeer. __ • Highest numbered node always wins. • Lowest numbered node always has the last word. • Initiator chooses most resourceful node as coordinator. • Zeroth node identifier in each series marks DHT-based coordinators. Repulsive tokens settle on multiple coordinators in randomly unstructured systems.

More Related