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.
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.
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.
20101 Synchronization in distributed systems A collection of independent computers that appears to its users as a single coherent system.
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure mutual exclusion.
Operating Systems, 2011, Danny Hendler & Amnon Meisels 1 Distributed Mutual Exclusion  Introduction  Ricart and Agrawala's algorithm  Raymond's algorithm.
Distributed Mutual Exclusion Béat Hirsbrunner References G. Coulouris, J. Dollimore and T. Kindberg "Distributed Systems: Concepts and Design", Ed. 4,
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms.
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.
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.
CSC Distributed Mutual Exclusion Presenter: Weiling Li Instructor: Dr. Zhang.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Vector timestamps Global state –Distributed Snapshot Election algorithms –Bully algorithm.
Chapter 2/6 –Critical Section Problem / Mutual exclusion progress, bounded wait –Hardware Solution disable interrupts –problems ? –Software Solution busy.
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.
1 Distributed Process Management Chapter Distributed Global States Operating system cannot know the current state of all process in the distributed.
Presenter: Long Ma Advisor: Dr. Zhang 4.5 DISTRIBUTED MUTUAL EXCLUSION.
Studying Different Problems from Distributed Computing Several of these problems are motivated by trying to use solutiions used in `centralized computing’
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.
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.
Synchronization: Distributed Mutual Exclusion (Week:6)
A Tree Based Algorithm fro Distributed Mutual Exclusion Addy Gronquist 11/19/2003.
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.
From Coulouris, Dollimore, Kindberg and Blair Distributed Systems: Concepts and Design Edition 5, © Addison-Wesley 2012 Slides for Chapter 15: Coordination.
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.
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
Introduction Many distributed systems require that participants agree on something On changes to important data On the status of a computation On what.
4.5 Distributed Mutual Exclusion
Synchronization: Distributed Deadlock Detection
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.
Mutual Exclusion Continued
Distributed Mutual Exclusion
Practical Session 13 Distributed synchronization
Distributed Mutex EE324 Lecture 11.
Outline Distributed Mutual Exclusion Introduction Performance measures
Lecture 2 Part 2 Process Synchronization
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
Concurrency: Mutual Exclusion and Process Synchronization
CSE 486/586 Distributed Systems Mutual Exclusion
Lecture 10: Coordination and Agreement
Synchronization (2) – Mutual Exclusion
Distributed Deadlock Detection
Distributed Mutual Exclusion
Lecture 11: Coordination and Agreement
Distributed algorithms
Distributed Systems and Concurrency: Synchronization in Distributed Systems Majeed Kassis.
Distributed Mutual eXclusion
CSE 486/586 Distributed Systems Mutual Exclusion
Presentation transcript:

Distributed Mutual Exclusion Fall 2007 Himanshu Bajpai hbajpai1@student.gsu.edu

Overview Distributed Mutual Exclusion Contention-based Mutual Exclusion Timestamp Prioritized Schemes Voting Schemes Token-based Mutual Exclusion Ring Structure Tree Structure Broadcast Structure

Preview [Randy Chow ’98] There are three major communication scenarios: One-way, client/server, and peer communication. One-way communication usually do not need synchronization. Client/server communication is for multiple clients making service request to a shared server. If co-ordination is required among the clients, it is handled by the server and

Contd.. there is no explicit interaction among client process. But, intercrosses communication is just not limited to making service requests. Oftentimes processes need to exchange information to reach some conclusion about the system or some agreement among the cooperating processes.

Contd.. These activities require peer communication; there is no shared object or centralized controller.

Distributed Mutual Exclusion [Randy Chow ’98] Mutual exclusion (often abbreviated to mutex) ensures that concurrent processes make a serialized access to shared resources or data (e.g., updating a database or sending control signals to an I/O device).

Contd… A distributed mutual exclusion algorithm achieves mutual exclusion using only peer communication. The problem can be solved using either a contention-based or a token-based approach.

Contention-based Mutual Exclusion[2] A contention-based approach means that each process freely and equally competes for the right to use shared resource by using a request resolution criteria. The resolution criteria may be based on the times of requests, priorities of the requesters, or voting.

Contd.. Contention for the critical section can be resolved by any criteria for braking ties when simultaneous request occurs. The fairest way is to grant the request to the process which asked first (in logical time) or the process which got the most votes from the other processes. We will call these two different approaches timestamp prioritized and voting schemes.

Timestamp Prioritized Schemes Approach due to Lamport.  These are the general properties for the method:   The general mechanism is for a process P[i]  to send a request ( with ID and time stamp ) to all other processes. When a process P[j] receives such a request, it may reply immediately or it may defer sending a reply back.

Contd.. When responses are received from all processes, then P[i] can enter its Critical Section. When P[i] exits its critical section, the process sends reply messages to all its deferred requests. The total message count is 3*(N-1), where N is the number of cooperating processes.

Ricart and Agrawala algo..[1] Requesting Site: A requesting site Pi sends a message request(ts,i) to all sites. Receiving Site: Upon reception of a request(ts,i) message, the receiving site Pj will immediately send a timestamped reply(ts,j) message if and only if: Pj is not requesting or executing the critical section OR Pj is requesting the critical section but sent a request with a higher timestamp than the timestamp of Pi Otherwise, Pj will defer the reply message.

Contd.. Critical Section: Site Pi enters its critical section only after receiving all reply messages. Upon exiting the critical section, Pi sends all deferred reply messages. Performance Number of network messages; 2*(N-1) Synchronization Delays: One message propagation delay

Contd.. Common Optimizations Once site Pi has received a reply message from site Pj, site Pi may enter the critical section without receiving permission from Pj until Pi has sent a reply message to Pj Problems One of the problems in this algorithm is failure of a node. In such a situation a process may starve forever. This problem can be solved by detecting failure of nodes after some timeout.

Voting Schemes [2] Requestor: Send a request to all other process. Enter critical section once REPLY from a majority is received Broadcast RELEASE upon exit from the critical section.   Other processes:  REPLY to a request if no REPLY has been sent. Otherwise, hold the request in a queue. If a REPLY has been sent, do not send another REPLY till the RELEASE is received.

Contd.. Observations:  No single point of failure, but possibility of deadlock. O(N) messages per request.

Voting Scheme (Improved-1) Requestor:  Send a request with time stamp to all other process. Enter critical section once REPLY from a majority is received Return the REPLY message upon receipt of an INQUIRY if not currently executing in the critical section. Broadcast RELEASE upon exit from the critical section.

Contd.. Other processes: If no REPLY has been sent, REPLY to any REQUEST. If a REPLY has been sent but the RELEASE has not been received, compare the time stamp of the new REQUEST with the time stamp of the replied REQUEST. If the new REQUEST has an earlier time stamp, try to retract the old REPLY sending INQUIRY message. If the older REPLY is returned, send REPLY to the new REQUEST. Otherwise, wait for the RELEASE.

Contd.. Observation:  High (O(N)) messages per critical section entry.

Token-based Mutual Exclusion[3] Although contention-based distributed mutual exclusion algorithms can have attractive properties, their messaging overhead is high. An alternative to contention-based algorithms is to use an explicit control token, possession of which grant access to the critical section.

Contd.. If there is only one token mutual exclusion is assured. Different methods for requesting and passing the token give different performance and fairness properties. To ensure that a request gets routed to the token holder and the token routed to the requester, algorithms impose a logical structure on the processes.

Ring Structure A completely different approach to achieving mutual exclusion in a distributed system is illustrated in Fig. Here we have a bus network, as shown in Fig. a, (e.g., Ethernet), with no inherent ordering of the processes. In software, a logical ring is constructed in which each process is assigned a position in the ring, as shown in Fig. b. The ring positions may be allocated in numerical order of network addresses or some other means. It does not matter what the ordering is. All that matters is that each process knows who is next in line after itself.

Contd..

Contd… simple, deadlock-free, fair. The token circulates even in the absence  of any request (unnecessary traffic). Long path (O(N)) – the wait for token may  be high.

Tree Structure [3;5] The processes are organized in a logical tree structure, each node pointing to its parent. Further, each node maintains a FIFO list of token requesting neighbors. Each node has a variable Tokenholder initialized to false for everybody except for the first token holder (token generator).  

Contd..

Contd.. Entry section: If not Tokenholder If the request queue empty request token from parent; put itself in request queue; block self until Tokenholder is true;

Contd.. Exit section:  If the request queue is not empty     parent = dequeue(request queue);     send token to parent;      set Tokenholder to false;      if the request queue is still not empty, request token from parent;

Contd.. Upon receipt of a request: If Tokenholder If in critical section put the requestor in the queue  else            parent = requestor; Tokenholder = false; send token to parent;  endif                else           if the queue is empty       send a request to the parent;                                     put the requestor in queue;   

Contd.. Upon receipt of a token: Parent = Dequeue(request queue); if self is the parent Tokenholder= true else         send token to the parent;      if the queue is not empty       request token from parent; 

Broadcast Structure Data Structure: The token contains Token vector T(.) – number of completion of the critical section for every process.    Request queue Q(.) – queue of requesting processes. Every process (i) maintains the following      seq_no – how many times i requested critical section.   Si(.) – the highest sequence number from every process i heard of.

Contd.. Entry Section (process i): Broadcast a REQUEST message stamped with seq_no. Enter critical section after receiving token.

Contd.. Exit Section (process i): Update the token vector T by setting T(i) to Si(i). If process k is not in request queue Q and there are pending requests from k (Si(k)>T(k)), append process k to Q. If Q is non-empty, remove the first entry from Q and send the token to the process indicated by the top entry.

Contd.. Processing a REQUEST (process j): Set Sj(k) to max(Sj(k), seq_no) after receiving a REQUEST from process k. If holds an idle token, send it to k.  Requires broadcast. Therefore message overhead is high.

References 1. http://en.wikipedia.org/wiki/Ricart-Agrawala_algorithm 1. http://en.wikipedia.org/wiki/Ricart-Agrawala_algorithm Author “Jerry Breecher ” http://209.85.165.104/search?q=cache:-jmGub2By8EJ:cs.clarku.edu/~jbreecher/os/lectures/Section18-Distributed_Coordination.ppt+timestamp+prioritized+schemes+request+reply+release+method&hl=en&ct=clnk&cd=1&gl=us 3. Author “Rajgopal Kannan” http://209.85.165.104/search?q=cache:lwcn54j5W_MJ:bit.csc.lsu.edu/~rkannan/rk7103_chpt4.ppt+Voting+schemes+method+in+contention+based+mutual+exclusion&hl=en&ct=clnk&cd=3&gl=us

Contd.. 4. Distributed operating systems & Algorithms, By Randy chow, Theodore Johnson. 1998 5. Author = “Kerry Raymond” 1989 http://delivery.acm.org/10.1145/60000/59295/p61-raymond.pdf?key1=59295&key2=1979241911&coll=GUIDE&dl=GUIDE&CFID=1528714&CFTOKEN=58116800