1 / 10

Revisiting Logical Clocks: Mutual Exclusion

Revisiting Logical Clocks: Mutual Exclusion. Problem statement: Given a set of n processes, and a shared resource, it is required that: Mutual exclusion At any time, at most one process is accessing the resource Liveness

romeo
Download Presentation

Revisiting Logical Clocks: Mutual Exclusion

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. Revisiting Logical Clocks: Mutual Exclusion Problem statement: Given a set of n processes, and a shared resource, it is required that: • Mutual exclusion • At any time, at most one process is accessing the resource • Liveness • If a process requests for the resource, it can eventually access the resource

  2. Solution to mutual exclusion • How could we do this if all processes shared a common clock • Each process timestamps its request • The process with lowest timestamp is allowed to access critical section • What are the properties of clocks that enable us to solve this problem? • Is there another type of clock that could help is to solve this problem

  3. Solution to mutual exclusion, based on logical clocks • Messages are timestamped with logical clocks • Each process maintains a queue of pending requests • When process j wants to access the resource, it adds its timestamp to the queue, and sends a request message containing its timestamp to all other processes • When process k receives a request message from j, it sends a reply message to j

  4. Solution to mutual exclusion, based on logical clocks (continued) • Process j accesses the resource (enters critical section) iff • it has received a reply from every other process • its queue does not contain a timestamp that is smaller than its own request • After a process is done accessing its critical section, it sends a release message to all processes and removes its own request from the pending queue • When a process k receives the release message from j,it removes the entry of j from its pending queue

  5. Solution to mutual exclusion, based on logical clocks (continued) • This is called Lamport’s mutual exclusion algorithm • What is the number of messages sent for every access to critical section?

  6. Optimizations • Should a process wait for a reply message from every other process? • Should a process send a reply message immediately? • Answer these questions to obtain a protocol where only 2 (n-1) messages are used for each critical section

  7. Classification of Mutual Exclusion Algorithms • Quorum Based • Each node is associated with a quorum Qj • When j wants to enter critical section, it asks for permission from all nodes in this quorum • What property should be met by the quorums of different processes? • Token Based • A token is circulated among nodes; the node that has the token can access critical section • We will look at these later

  8. Which category would Lamport’s protocol fit in? • What is the quorum of a process in this algorithm? • What are the possibilities of different quorums

  9. Taking Quorum Based Algorithms to Extreme • Centralized mutual exclusion • A single process `coordinator' is responsible for ensuring • mutual exclusion. • Each process requests the coordinator whenever it wishes to access the resource. • The coordinator permits only one process to access the resource at a time. • After a process accesses the resource, it sends a reply to the coordinator. • Quorum for all processes is {c} where c is the coordinator

  10. Centralized mutual exclusion • Problem : What if the coordinator fails? • Solution : Elect a new one

More Related