Page 1 Mutual Exclusion* Distributed Systems *referred to slides by Prof. Paul Krzyzanowski at Rutgers University and Prof. Mary Ellen Weisskopf at University.

Slides:



Advertisements
Similar presentations
CS542 Topics in Distributed Systems Diganta Goswami.
Advertisements

Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
1 Algorithms and protocols for distributed systems We have defined process groups as having peer or hierarchical structure and have seen that a coordinator.
Synchronization in Distributed Systems
Page 1 Lecturer: Roohollah Abdipour Acknowledgment: Many of the slides are based on slides by Prof. Paul Krzyzanowski at Rutgers University,
CS 582 / CMPE 481 Distributed Systems
What we will cover…  Distributed Coordination 1-1.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
1. Explain why synchronization is so important in distributed systems by giving an appropriate example When each machine has its own clock, an event that.
CS603 Process Synchronization February 11, Synchronization: Basics Problem: Shared Resources –Generally data –But could be others Approaches: –Model.
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure mutual exclusion.
SynchronizationCS-4513, D-Term Synchronization in Distributed Systems CS-4513 D-Term 2007 (Slides include materials from Operating System Concepts,
Chapter 18: Distributed Coordination (Chapter 18.1 – 18.5)
Distributed Systems CS Synchronization – Part III Lecture 9, Oct 3, 2011 Majd F. Sakr, Vinay Kolar, Mohammad Hammoud.
Synchronization in Distributed Systems CS-4513 D-term Synchronization in Distributed Systems CS-4513 Distributed Computing Systems (Slides include.
Coordination in Distributed Systems Lecture # 8. Coordination Anecdotes  Decentralized, no coordination  Aloha ~ 18%  Some coordinating Master  Slotted.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 12: Mutual Exclusion All slides © IG.
Lecture 14 Synchronization (cont). EECE 411: Design of Distributed Software Applications Logistics Project P01 deadline on Wednesday November 3 rd. Non-blocking.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Election Algorithms. Topics r Issues r Detecting Failures r Bully algorithm r Ring algorithm.
Distributed Mutex EE324 Lecture 11.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved Chapter 6 Synchronization.
Mutual exclusion Concurrent access of processes to a shared resource or data is executed in mutually exclusive manner Distributed mutual exclusion can.
CSE 486/586, Spring 2013 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
4.5 DISTRIBUTED MUTUAL EXCLUSION MOSES RENTAPALLI.
4.5 Distributed Mutual Exclusion Ranjitha Shivarudraiah.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
1 Mutual Exclusion: A Centralized Algorithm a)Process 1 asks the coordinator for permission to enter a critical region. Permission is granted b)Process.
Operating Systems Distributed Coordination. Topics –Event Ordering –Mutual Exclusion –Atomicity –Concurrency Control Topics –Event Ordering –Mutual Exclusion.
CS425 /CSE424/ECE428 – Distributed Systems – Fall 2011 Material derived from slides by I. Gupta, M. Harandi, J. Hou, S. Mitra, K. Nahrstedt, N. Vaidya.
Coordination and Agreement. Topics Distributed Mutual Exclusion Leader Election.
Synchronization CSCI 4780/6780. Mutual Exclusion Concurrency and collaboration are fundamental to distributed systems Simultaneous access to resources.
Fall 2007cs4251 Distributed Computing Umar Kalim Dept. of Communication Systems Engineering 15/01/2008.
Presenter: Long Ma Advisor: Dr. Zhang 4.5 DISTRIBUTED MUTUAL EXCLUSION.
Vector Clock Each process maintains an array of clocks –vc.j.k denotes the knowledge that j has about the clock of k –vc.j.j, thus, denotes the clock of.
Synchronization Chapter 5.
1 Clock Synchronization & Mutual Exclusion in Distributed Operating Systems Brett O’Neill CSE 8343 – Group A6.
Lecture 10 – Mutual Exclusion Distributed Systems.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion & Leader Election Steve Ko Computer Sciences and Engineering University.
Tanenbaum & Van Steen, Distributed Systems: Principles and Paradigms, 2e, (c) 2007 Prentice-Hall, Inc. All rights reserved DISTRIBUTED SYSTEMS.
Page 1 Mutual Exclusion & Election Algorithms Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content.
Lecture 12-1 Computer Science 425 Distributed Systems CS 425 / CSE 424 / ECE 428 Fall 2012 Indranil Gupta (Indy) October 4, 2012 Lecture 12 Mutual Exclusion.
Lecture 7- 1 CS 425/ECE 428/CSE424 Distributed Systems (Fall 2009) Lecture 7 Distributed Mutual Exclusion Section 12.2 Klara Nahrstedt.
Synchronization in Distributed Systems Chapter 6.3.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
Distributed Mutual Exclusion Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
CS3771 Today: Distributed Coordination  Previous class: Distributed File Systems Issues: Naming Strategies: Absolute Names, Mount Points (logical connection.
CSC 8420 Advanced Operating Systems Georgia State University Yi Pan Transactions are communications with ACID property: Atomicity: all or nothing Consistency:
Revisiting Logical Clocks: Mutual Exclusion Problem statement: Given a set of n processes, and a shared resource, it is required that: –Mutual exclusion.
Lecture 11: Coordination and Agreement Central server for mutual exclusion Election – getting a number of processes to agree which is “in charge” CDK4:
CS 425 / ECE 428 Distributed Systems Fall 2015 Indranil Gupta (Indy) Oct 1, 2015 Lecture 12: Mutual Exclusion All slides © IG.
Mutual Exclusion A condition in which there is a set of processes, only one of which is able to access a given resource or perform a given function at.
Distributed Mutex EE324 Lecture 11.
Chapter 6.3 Mutual Exclusion
Distributed Mutual Exclusion
Outline Distributed Mutual Exclusion Introduction Performance measures
Distributed Systems CS
CSE 486/586 Distributed Systems Mutual Exclusion
Lecture 10: Coordination and Agreement
Synchronization (2) – Mutual Exclusion
Prof. Leonardo Mostarda University of Camerino
Lecture 11: Coordination and Agreement
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
Distributed Mutual eXclusion
CSE 486/586 Distributed Systems Mutual Exclusion
Presentation transcript:

Page 1 Mutual Exclusion* Distributed Systems *referred to slides by Prof. Paul Krzyzanowski at Rutgers University and Prof. Mary Ellen Weisskopf at University of Alabama in Huntsville

Page 2 Mutual Exclusion? A condition in which there is a set of processes, only one of which is able to access a given resource or perform a given function at any time

Page 3 Centralized Systems Mutual exclusion via: –Test & set –Semaphores –Messages –Monitors

Page 4 Distributed Mutual Exclusion Assume there is agreement on how a resource is identified –Pass identifier with requests Create an algorithm to allow a process to obtain exclusive access to a resource

Page 5 Distributed Mutual Exclusion Centralized Algorithm Token Ring Algorithm Distributed Algorithm Decentralized Algorithm

Page 6 Centralized algorithm Mimic single processor system One process elected as coordinator P C request(R) grant(R) 1. Request resource 2. Wait for response 3. Receive grant 4. access resource 5. Release resource release(R)

Page 7 Centralized algorithm If another process claimed resource: –Coordinator does not reply until release –Maintain queue Service requests in FIFO order P0P0 C request(R) grant(R) release(R) P1P1 P2P2 request(R) Queue P1P1 request(R) P2P2 grant(R)

Page 8 Centralized algorithm Benefits Fair –All requests processed in order Easy to implement, understand, verify Problems Process cannot distinguish being blocked from a dead coordinator Centralized server can be a bottleneck

Page 9 Token Ring algorithm Assume known group of processes –Some ordering can be imposed on group –Construct logical ring in software –Process communicates with neighbor P0P0 P1P1 P2P2 P3P3 P4P4 P5P5

Page 10 Token Ring algorithm Initialization –Process 0 gets token for resource R Token circulates around ring –From P i to P (i+1) mod N When process acquires token –Checks to see if it needs to enter critical section –If no, send token to neighbor –If yes, access resource Hold token until done P0P0 P1P1 P2P2 P3P3 P4P4 P5P5 token(R)

Page 11 Token Ring algorithm Only one process at a time has token –Mutual exclusion guaranteed Order well-defined –Starvation cannot occur If token is lost (e.g. process died) –It will have to be regenerated Does not guarantee FIFO order

Page 12 Ricart & Agrawala algorithm Distributed algorithm using reliable multicast and logical clocks Process wants to enter critical section: –Compose message containing: Identifier (machine ID, process ID) Name of resource Timestamp (totally-ordered Lamport) –Send request to all processes in group –Wait until everyone gives permission –Enter critical section / use resource

Page 13 Ricart & Agrawala algorithm When process receives request: –If receiver not interested: Send OK to sender –If receiver is in critical section Do not reply; add request to queue –If receiver just sent a request as well: Compare timestamps: received & sent messages Earliest wins If receiver is loser, send OK If receiver is winner, do not reply, queue When done with critical section –Send OK to all queued requests

Page 14 Ricart & Agrawala algorithm N points of failure A lot of messaging traffic Demonstrates that a fully distributed algorithm is possible

Page 15 Lamport’s Mutual Exclusion Each process maintains request queue –Contains mutual exclusion requests Requesting critical section: –Process P i sends request(i, T i ) to all nodes –Places request on its own queue –When a process P j receives a request, it returns a timestamped ack Lamport time

Page 16 Lamport’s Mutual Exclusion Entering critical section (accessing resource) : –P i received a message (ack or release) from every other process with a timestamp larger than T i –P i ’s request has the earliest timestamp in its queue Difference from Ricart-Agrawala: –Everyone responds … always - no hold-back –Process decides to go based on whether its request is the earliest in its queue

Page 17 Lamport’s Mutual Exclusion Releasing critical section: –Remove request from its own queue –Send a timestamped release message –When a process receives a release message Removes request for that process from its queue This may cause its own entry have the earliest timestamp in the queue, enabling it to access the critical section

Characteristics of Decentralized Algorithms l No machine has complete information about the system state l Machines make decisions based only on local information l Failure of one machine does not ruin the algorithm l Three is no implicit assumption that a global clock exists

Page 19 Decentralized Algorithm Based on the Distributed Hash Table (DHT) system structure previously introduced –Peer-to-peer –Object names are hashed to find the successor node that will store them Here, we assume that n replicas of each object are stored

Page 20 Placing the Replicas The resource is known by a unique name: rname –Replicas: rname-0, rname-I, …, rname-(n-1) –rname-i is stored at succ(rname-i), where names and site names are hashed as before –If a process knows the name of the resource it wishes to access, it also can generate the hash keys that are used to locate all the replicas

Page 21 The Decentralized Algorithm Every replica has a coordinator that controls access to it (the coordinator is the node that stores it) For a process to use the resource it must receive permission from m > n/2 coordinators This guarantees exclusive access as long as a coordinator only grants access to one process at a time

Page 22 The Decentralized Algorithm The coordinator notifies the requester when it has been denied access as well as when it is granted –Requester must “count the votes”, and decide whether or not overall permission has been granted or denied If a process (requester) gets fewer than m votes it will wait for a random time and then ask again

Page 23 Analysis If a resource is in high demand, multiple requests will be generated It’s possible that processes will wait a long time to get permission Deadlock? Resource usage drops

Page 24 Analysis More robust than the central coordinator approach and the distributed approaches. If one coordinator goes down others are available. –If a coordinator fails and resets then it will not remember having granted access to one requestor, and may then give access to another. According to the authors, it is highly unlikely that this will lead to a violation of mutual exclusion. (See the text for a probabilistic argument.)