MUTUAL EXCLUSION AND QUORUMS CS 2711. Distributed Mutual Exclusion Given a set of processes and a single resource, develop a protocol to ensure exclusive.

Slides:



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

Chapter 12 Message Ordering. Causal Ordering A single message should not be overtaken by a sequence of messages Stronger than FIFO Example of FIFO but.
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.
1 CS 194: Elections, Exclusion and Transactions Scott Shenker and Ion Stoica Computer Science Division Department of Electrical Engineering and Computer.
Synchronization Chapter clock synchronization * 5.2 logical clocks * 5.3 global state * 5.4 election algorithm * 5.5 mutual exclusion * 5.6 distributed.
Page 1 Mutual Exclusion* Distributed Systems *referred to slides by Prof. Paul Krzyzanowski at Rutgers University and Prof. Mary Ellen Weisskopf at University.
Distributed Systems Spring 2009
CS 582 / CMPE 481 Distributed Systems
Ordering and Consistent Cuts Presented By Biswanath Panda.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
CS603 Process Synchronization February 11, Synchronization: Basics Problem: Shared Resources –Generally data –But could be others Approaches: –Model.
20101 Synchronization in distributed systems A collection of independent computers that appears to its users as a single coherent system.
CS 425 / ECE 428 Distributed Systems Fall 2014 Indranil Gupta (Indy) Lecture 12: Mutual Exclusion All slides © IG.
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.
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
CIS 720 Distributed algorithms. “Paint on the forehead” problem Each of you can see other’s forehead but not your own. I announce “some of you have paint.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed Mutual Exclusion.
Distributed Mutex EE324 Lecture 11.
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.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
Page 1 Logical Clocks Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation is.
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.
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.
Event Ordering Greg Bilodeau CS 5204 November 3, 2009.
Studying Different Problems from Distributed Computing Several of these problems are motivated by trying to use solutiions used in `centralized computing’
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport Massachusetts Computer Associates,Inc. Presented by Xiaofeng Xiao.
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.
ITEC452 Distributed Computing Lecture 6 Mutual Exclusion Hwajung Lee.
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.
An Efficient and Fault-Tolerant Solution for Distributed Mutual Exclusion by D. Agrawal, A.E. Abbadi Presentation by Peter Tsui for COEN 317, F/03.
CS 3471 CS 347: Parallel and Distributed Data Management Notes13: Time and Clocks.
CS 347Notes 121 CS 347: Parallel and Distributed Data Management Notes12: Time and Clocks Hector Garcia-Molina.
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
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.
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.
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.
Implementation of Ricart Agrawala Algorithm
Mutual Exclusion Continued
Distributed Mutual Exclusion
Distributed Mutex EE324 Lecture 11.
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 Mutual Exclusion
Synchronization (2) – Mutual Exclusion
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
Distributed Mutual eXclusion
CSE 486/586 Distributed Systems Mutual Exclusion
Presentation transcript:

MUTUAL EXCLUSION AND QUORUMS CS 2711

Distributed Mutual Exclusion Given a set of processes and a single resource, develop a protocol to ensure exclusive access to the resource by a single process at a time. This is a fundamental operation in operating systems, and is generalized to locking in databases. CS 2712

Centralized Solution Choose a special coordinator site, coord. Coord maintains a queue of pending requests. Protocol: – Process send request to coord. – If no other request, coord sends back reply. Otherwise, put request in queue – On receipt of reply, process accesses resource. – Once done, process sends release to coord. – On receipt of release, coord checks queue for any pending requests. CS 2713

Centralized Solution P0P0 C request(R) reply(R) release(R) P1P1 P2P2 request(R) Queue P1P1 request(R) P2P2 reply(R) CS 2714 thanks paul krzyzanowski rutgers

Distributed Solution Instead of a central coordinator, all processes collectively Use similar approach: – Process sends request to all processes and puts request in local queue. – On receipt of request, process sends back reply. – Process accesses resource On receipt of all replies Own request at head of queue – Once done, process sends release to all processes. – On receipt of release, process removes request CS 2715

Distributed Solution Does this work (Lamport original solution)? Need to order queues so they are identical: – Use logical Lamport time + proc id to break ties. – FIFO channels Requests are executed in causal order. Ricart and Agrawala’s optmization: – If a process also wants resource, it replies only if request has lower timestamp (higher priority). – No need for FIFO CS 2716

Quorums What if there are failures? Do we need to communicate with ALL processes? Any two requests should have a common process to act as an arbitrator. Let process p i (p j )request permission from V i (V j ), then – V i ⋂ V j ≠ ϕ. V i is called a quorum. Basic protocol still works (basically think locking), but: Deadlock CS 2717

Quorums Given n processes: 2|V i | >n, ie, In general, majority, ie ⌈ (n/2) ⌉. [Gifford 79] CS 2718

Studying the Sizes of Quorums Can we have quorums of sizes LESS than majority? Yes, but we need to set up some basic ground rules. CS 2719

Maekawa’s Mutual Exclusion Assume process p i gets permission from quorum Q i and there are N processes. 1.Q i contains p i. 2.Equal Effort: |Q 1 |=|Q 2 |=…….|Q n |= K 3.Equal Responsibility: Every process is included in M quorums only. CS 27110

Minimality Result Each member of Q i is in M-1 other quorums. Max number of quorums: K(M-1) +1 Since # of quorums = # of processes N = K(M-1) +1 …………………..(1) N= (# of elements)/(# duplicates of elements) N= K*N/M  K=M ………… (2) From (1) and (2): N= K(K-1) + 1 Hence K= O( √ (N)) CS 27111

Quorum Sizes Finite Projective Plane Theory for N points ensure quorums of size √ (n). Easier, grid structure and any row and column. CS 27112

Quorum Sizes CS 27113

Tree Structure CS

Tree Quorum Algorithm A path is a sequence of nodes such that each node is the parent of the next one in sequence. 1.Select a path from root to leaf. 2.If successful  this is the quorum. 3.O.W.  for each inaccessible node, pick two paths from 2 children to leaves. 4.Repeat recursively for all inaccessible nodes. Correctness Proof: By Induction. CS 27115

Tree Quorum Sizes Best case: log(n). Worst case: n/2 CS 27116

General Quorums In a database context, we have read and write operations. Hence, read quorums, Q r, and write quorums, Q w. Simple generalization: – Q r ⋂ Q w ≠ϕ, Q w ⋂ Q w ≠ϕ – Q r + Q w > n and 2 Q w > n CS 27117

Basic Concepts up to now Happens before and causality Logical (Lamport) Clocks Vector Clocks Mutual Exclusion Quorums CS 27118