Distributed Mutual eXclusion

Slides:



Advertisements
Similar presentations
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Distributed Mutual Exclusion.
Advertisements

CS542 Topics in Distributed Systems Diganta Goswami.
Ricart and Agrawala’s Algorithm
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Page 1 Mutual Exclusion* Distributed Systems *referred to slides by Prof. Paul Krzyzanowski at Rutgers University and Prof. Mary Ellen Weisskopf at 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.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 12: Mutual Exclusion All slides © IG.
Distributed Mutual Exclusion Béat Hirsbrunner References G. Coulouris, J. Dollimore and T. Kindberg "Distributed Systems: Concepts and Design", Ed. 4,
1 Distributed Process Management: Distributed Global States and Distributed Mutual Exclusion.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed Mutual Exclusion.
Distributed Mutual Exclusion
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.
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion Steve Ko Computer Sciences and Engineering University at Buffalo.
MUTUAL EXCLUSION AND QUORUMS CS Distributed Mutual Exclusion Given a set of processes and a single resource, develop a protocol to ensure exclusive.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
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.
Presenter: Long Ma Advisor: Dr. Zhang 4.5 DISTRIBUTED MUTUAL EXCLUSION.
1 Chapter 10 Distributed Algorithms. 2 Chapter Content This and the next two chapters present algorithms designed for loosely-connected distributed systems.
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.
Studying Different Problems from Distributed Computing Several of these problems are motivated by trying to use solutiions used in `centralized computing’
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Mutual Exclusion & Leader Election Steve Ko Computer Sciences and Engineering University.
ITEC452 Distributed Computing Lecture 6 Mutual Exclusion Hwajung Lee.
1.Mutual Exclusion in Distributed Systems 2.Non-Token-Based Algorithms 3.Token-Based Algorithms 4.Distributed Election 5.The Bully and the Ring-Based Algorithms.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are: 1. Resource sharing 2. Avoiding concurrent update on shared data 3. Controlling the.
CS 425 / ECE 428 Distributed Systems Fall 2015 Indranil Gupta (Indy) Oct 1, 2015 Lecture 12: Mutual Exclusion All slides © IG.
Page 1 Mutual Exclusion & Election Algorithms Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content.
A Torus Quorum Protocol for Distributed Mutual Exclusion A Torus Quorum Protocol for Distributed Mutual Exclusion S.D. Lang and L.J. Mao School of Computer.
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.
Decentralized solution 1
CIS 825 Review session. P1: Assume that processes are arranged in a ring topology. Consider the following modification of the Lamport’s mutual exclusion.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
Hwajung Lee. Mutual Exclusion CS p0 p1 p2 p3 Some applications are:  Resource sharing  Avoiding concurrent update on shared data  Controlling the.
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.
CS 425 / ECE 428 Distributed Systems Fall 2015 Indranil Gupta (Indy) Oct 1, 2015 Lecture 12: Mutual Exclusion All slides © IG.
Lecture 18: Mutual Exclusion
Coordination and Agreement
4.5 Distributed Mutual Exclusion
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.
CSE 486/586 Distributed Systems Leader Election
Chapter 18 Distributed Control Algorithms
Mutual Exclusion Continued
Distributed Mutual Exclusion
Distributed Mutex EE324 Lecture 11.
Comparison between Suzuki Kasami’s and Raymond’s Tree Algorithm
Distributed Mutual Exclusion
Decentralized solution 1
Mutual Exclusion Problem Specifications
ITEC452 Distributed Computing Lecture 7 Mutual Exclusion
Outline Distributed Mutual Exclusion Introduction Performance measures
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
CSE 486/586 Distributed Systems Leader Election
Concurrency: Mutual Exclusion and Process Synchronization
CSE 486/586 Distributed Systems Mutual Exclusion
Lecture 10: Coordination and Agreement
Synchronization (2) – Mutual Exclusion
ITEC452 Distributed Computing Lecture 7 Mutual Exclusion
Lecture 11: Coordination and Agreement
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
Advanced Operating System Maekawa vs. Ricart-Agrawala By Rizal M Nor
CSE 486/586 Distributed Systems Mutual Exclusion
CSE 486/586 Distributed Systems Leader Election
Presentation transcript:

Distributed Mutual eXclusion DMX definitions DMX vs. single-computer MX DMX taxonomy measuring performance of a DMX algorithm trivial DMX algorithm – central coordinator non-token-based DMX algorithms Lamport’s Ricart-Agrawala’s Maekawa’s Raymond’s extension to K-exclusion

Distributed Mutual eXclusion N processes share a single resource, and require mutually-exclusive access assumptions: reliable FIFO channels, fully connected topology the process accessing the shared resource is in the critical section (CS), process wishing to access the resource is requesting the CS each process may or may not request the CS during a computation CS execution is always finite properties: safety - only one process can access the shared resource at a time liveness - if a process requests to access the shared resource it should eventually be given a chance to do so

Single-Computer MX vs. DMX single computer MX (also called shared memory MX) similar to DMX problem - multiple processes compete for CS execution processes have access to shared variables/clock (presumed to be executed on the same machine) shared-memory solutions use synchronization primitives (locks/condition variables, semaphores) in DMX do not have access to shared memory/clock synchronization has to be done without shared memory delays in propagation of information are unpredictable

DMX Algorithms Taxonomy Lock-based (aka permission based, non-token based) - to enter the CS a process needs to obtain permission from other processes in the system. Lamport Ricart-Agrawala Maekawa Token-based - unique token (privilege) circulated in the system. A process possessing the token can enter CS Suziki-Kasami LeLann Raymond

Measuring DMX Performance metrics to measure performance of DMX algorithms message complexity - number of messages per CS entry synchronization delay – number of causally related messages required after one process leaves CS and another process enters CS conditions for metric evaluation low and high load - the number of processes in the system simultaneously requesting CS worst and average case

7/25/2019 Central Coordinator one process is coordinator – maintains queue of requests to enter the critical section, a process sends a request message to the central coordinator when the coordinator receives a request: if no other process is in the critical section, it sends back a reply message if another process is in the critical section, the coordinator adds the request to the tail of its queue, and does not respond when the requesting process receives the reply message from the coordinator, it enters the critical section when it leaves the critical section, it sends a release message to coordinator when the coordinator receives a release message, it removes the request from the head of the queue, and sends a reply message to that process evaluation message complexity 3 synchronization delay 2T

Lamport’s Algorithm (1978) each process maintains a request queue, ordered by timestamp value requesting the CS: when a process wants to enter the CS, it: sends a timestamped request to all processes (including self) when a process receives a request, it: adds the request to timestamp-ordered request queue returns a reply executing the CS: a process enters the CS when both: 1. its request is at the top of its request queue (its request is earliest) 2. variant 1 – it has received a reply with greater timestamp form every process it the system variant 2 – it has received any message with greater timestamp

Lamport’s Algorithm (cont.) Releasing the CS: when a process leaves the CS, it: sends a timestamped release message to all processes in the system (including self when a process receives a release message, it: removes the (satisfied) request from its request queue note that that brings the next request to the head of the queue evaluation: message comlexity - 3(N–1) (N–1) release, (N–1) request, (N–1) reply synchronization delay - 1T

Ricart and Agrawala’s Algorithm (1981) optimization of Lamport’s – no releases (merged with replys) requesting the CS: when a process wants to enter the CS, it: sends a timestamped request to all OTHER processes when a process receives a request: if it is neither requesting nor executing the CS, it returns a reply (not timestamped) If it is requesting the CS, but the timestamp on the incoming request is smaller than the timestamp on its own request, it returns a reply means the other process requested first otherwise, it defers answering the request executing the CS: a process enters the CS when: it has received a reply from all other processes in the system

Ricart and Agrawala’s Algorithm (cont.) releasing the CS: When a process leaves the CS, it: Sends a reply message to all the deferred requests (process with next earliest request will now received its last reply message and enter the CS) evaluation: message complexity - 2(N–1) (N–1) reply, (N–1) request synchronization delay – 1 T

Maekawa’s Algorithm Lamport’s and Ricart-Agrawala’s have message complexity proportional to the number of processes in the system observation - a process does not have to send message to all other processes to lock them every process Pi is assigned a request set Ri (quorum) of processes Pi is in Ri (inclusion property) for any two processes Pi and Pj, Ri Ri (intersection property) Maekawa showed that minimum quorum size is N example quorums: for 3 processes: R0={P0,P1}, R1={P1,P2}, R2={P0,P2} for 7 processes: R0={P0,P1 ,P2}, R3={P0,P3 ,P4}, R5={P0,P5 ,P6}, R1={P1,P3 ,P5}, R4={P1,P4 ,P6}, R6={P2,P3 ,P6}, R2={P2,P4 ,P5} advantageous properties: uniqueness, equal effort, equal responsibility

Maekawa’s Algorithm, Basic Operation Requesting CS process requests CS by sending timestamped request message to processes in its quorum a process has just one permission to give, if a process receives a request it sends back reply unless it granted permission to other process; in which case the request is queued Entering CS process may enter CS when it receives replys from all processes in its quorum Releasing CS after exiting CS process sends release to every process in its quorum when a process gets release it sends reply to the lowest timestamped request in its queue

Maekawa’s Algorithm, Deadlock Possibility Since processes do not communicate with all other processes in the system, CS requests may be granted out of timestamp order example: suppose there are processes Pi, Pj, and Pk such that: Pj Ri and Pj Rk but Pk Ri and Pi Rk Pi and Pk request CS such that tsk < tsi if request Pi from reaches Pj first, then Pj sends reply to Pi and Pk has to wait for Pi out of timestamp order a wait-for cycle (hence a deadlock) may be formed

Maekawa’s Algorithm Deadlock Avoidance To avoid deadlock process recalls permission if it is granted out of timestamp order if Pj receives a request from Pi with higher timestamp than the request granted permission, Pj sends failed to Pi If Pj receives a request from Pi with lower timestamp than the request granted permission (deadlock possibility), Pj sends inquire to Pi when Pi receives inquire it replies with yield if it did not succeed getting permissions from other processes got failed

Raymond’s extension for sharing K identical resources (1987) K identical resources, which must be shared among N processes Raymond’s extension to Ricart-Agrawala’s algorithm: A process can enter the CS as soon as it has received N–K reply messages Algorithm is generally the same as R&A, with one difference: R&A — reply messages arrive only when process is waiting to enter CS Raymond — N–K reply messages arrive when process is waiting to enter CS Remaining K–1 reply messages can arrive when process is in the CS, after it leaves the CS, or when it’s waiting to enter the CS again Must keep a count of number of outstanding reply messages, and not count those toward next set of replies how would you modify Maekawa’s to share K resources?