4.5 Distributed Mutual Exclusion Ranjitha Shivarudraiah.

Slides:



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

Distributed Systems Major Design Issues Presented by: Christopher Hector CS8320 – Advanced Operating Systems Spring 2007 – Section 2.6 Presentation Dr.
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.
Synchronization in Distributed Systems
Distributed Systems Spring 2009
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.
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.
Operating Systems, 2011, Danny Hendler & Amnon Meisels 1 Distributed Mutual Exclusion  Introduction  Ricart and Agrawala's algorithm  Raymond's algorithm.
EEC-681/781 Distributed Computing Systems Lecture 11 Wenbing Zhao Cleveland State University.
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.
Dr. Kalpakis CMSC 621, Advanced Operating Systems. Fall 2003 URL: Distributed Mutual Exclusion.
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.
1 A Mutual Exclusion Algorithm for Ad Hoc Mobile networks Presentation by Sanjeev Verma For COEN th Nov, 2003 J. E. Walter, J. L. Welch and N. Vaidya.
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.
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.
Global State (1) a)A consistent cut b)An inconsistent cut.
Synchronization CSCI 4780/6780. Mutual Exclusion Concurrency and collaboration are fundamental to distributed systems Simultaneous access to resources.
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.
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.
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.
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:
Process Synchronization Presentation 2 Group A4: Sean Hudson, Syeda Taib, Manasi Kapadia.
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.
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.
Mutual Exclusion Continued
Distributed Mutual Exclusion
Distributed Mutex EE324 Lecture 11.
Chapter 6.3 Mutual Exclusion
Distributed Mutual Exclusion
Outline Distributed Mutual Exclusion Introduction Performance measures
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:

4.5 Distributed Mutual Exclusion Ranjitha Shivarudraiah

Agenda What is Mutual exclusion ? Mutual exclusion in Distributed operating systems. Mutual Exclusion algorithms Centralized Algorithms Distributed algorithms Contention based solutions Token based (Controlled) solutions Research Summary and Conclusions

What is Mutual exclusion? Mutual exclusion : makes sure that concurrent process access shared resources or data in a serialized way. If a process, say P i, is executing in its critical section, then no other processes can be executing in their critical sections Example: updating a DB or sending control signals to an IO device

What is Mutual exclusion ? Mutual exclusion in Distributed operating systems. Mutual Exclusion algorithms Centralized Algorithms Distributed algorithms  Contention based solutions  Control based solutions Research Summary and Conclusions

There are three major communication scenarios: 1. One-way Communication usually do not need synchronization. 2. 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 there is no explicit interaction among client process. Mutual exclusion in DOS

Mutual exclusion in Distributed operating systems Contd… 3. Interprocess communication: -> not limited to making service requests. -> processes need to exchange information to reach some conclusion about the system or some agreement among the cooperating processes. These activities require peer communication; there is no shared object or centralized controller.

What is Mutual exclusion ? Mutual exclusion in Distributed operating systems. Mutual Exclusion algorithms Centralized Algorithms Distributed algorithms  Contention based solutions  Control based solutions Research Summary and Conclusions

Mutual Exclusion algorithms Centralized algorithms Distributed Algorithms Contention Based Algorithms Timestamp prioritized schemes Voting schemes Controlled Algorithms (Token based algorithms) Tree Structure Broadcast Structure Ring Structure Mutual Exclusion Algorithms

Centralized Algorithm a). Process 1 asks the coordinator for permission to enter a critical region. Permission is granted b). Process 2 then asks permission to enter the same critical region. The coordinator does not reply. c). When process 1 exits the critical region, it tells the coordinator, which then replies to 2 [2]

Centralized algorithms contd.. Advantages  Fair algorithm, grants in the order of requests  The scheme is easy to implement  Scheme can be used for general resource allocation Critical Question: When there is no reply, does this mean that the coordinator is “dead” or just busy? Shortcomings  Single point of failure. No fault tolerance  Confusion between No-reply and permission denied  Performance bottleneck of single coordinator in a large system

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

Timestamp Prioritized Schemes A> Two processes want to enter the same critical region. B> Process 0 has the lowest timestamp, so it wins. C> When process 0 is done, it sends an OK also, so 2 can now enter the critical region[2]

Timestamp Prioritized Schemes Lamport’s “logical clock” is used to generate timestamps. These are the general properties for the method: The general mechanism is that a process P[i] has to send a REQUEST ( with ID and time stamp ) to all other processes. When a process P[j] receives such a request, it sends a REPLY back. W hen responses are received from all processes, then P[i] can enter its Critical Section. When P[i] exits its critical section, the process sends RELEASE 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 algorithm 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.

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

Ricart and Agrawala algorithm Contd.. Disadvantage of Ricart and Agarwala Algorithm: Failure of a node – May result in starvation. Solution: This problem can be solved by detecting failure of nodes after some timeout.[1]

Voting schemes Requestor: Send a request to all other processes. 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. [1] Possibility of a Deadlock Consider a situation when each candidate wins one-third of votes…..

Voting scheme,improvement One of the possible solutions would be : Any process retrieves its REPLY message by sending an INQUIRY if the requestor is not currently executing in the critical section. The Requestor has to return the vote through a RELINQUISH message.

Token-based Mutual Exclusion 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 grants access to the critical section.[1]

Ring Structure

Ring structure contd.. In software, a logical ring is constructed in which each process is assigned a position in the ring, as shown in the previous Fig. 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.[1]

Ring structure 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. Works out when the traffic load is high. Token can also carry state information.

Tree structure( Raymond’s Algorithm) Each process explicitly requests for a token and the token is moved only when no process if the process knows of a pending request.

Tree structure The root of the tree holds the token to start off. 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).

Tree Structured token passing

Tree Structure contd… 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). Entry Condition If not Tokenholder If the request queue empty request token from parent; put itself in request queue; block self until Tokenholder is true;

Tree Structure contd… Exit condition: 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;

Tree Structure contd… Upon receipt of 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( Suzuki/ Kasami’s algorithm). Imposing a logical topology like a ring or tree is efficient but also complex because the topology has to be implemented and maintained. Group communication: Unaware of the topology More transparent and desirable.

Broadcast structure Data Structure: The token contains Token vector T(.) – number of completions 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.

Broadcast structure contd… Entry condition: Broadcast a REQUEST message stamped with seq_no. Enter critical section after receiving token Exit Condition: Update the token vector T by setting T(i) to S i (i). If process k is not in request queue Q and there are pending requests from k (S i (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.

Comparison of the Mutual exclusion algorithms

What is Mutual exclusion ? Mutual exclusion in Distributed operating systems. Mutual Exclusion algorithms Centralized Algorithms Distributed algorithms  Contention based solutions Control based solutions Research Summary and Conclusions

Proposed Distributed Mutual Exclusion Algorithms A fair decentralized mutual exclusion algorithm for distributed systems is proposed in which processes communicate by asynchronous message passing. The algorithm requires between (N-1) and 2(N-1) messages per critical section access, where N is the number of processes in the system.[3] The Sigma algorithm that solves fault-tolerant mutual exclusion problem in dynamic systems where the set of processes may be large and change dynamically, processes may crash, and the recovery or replacement of crashed processes may lose all state information (memory losses) is introduced. [4]

Comparison of token based algorithms[6]

Distributed mutual exclusion algorithms for Ad-Hoc Networks[7]

Summary The concept of Mutual exclusion for Distributed operating systems introduced. Mutual Exclusion algorithms studied. Centralized Algorithms Distributed algorithms Contention based solutions Token based (Controlled) solutions Overview of the ongoing research.

References [1] Distributed operating systems & Algorithms, By Randy chow, Theodore Johnson [2] Distributed Operating sytems – Andrew S Tanenbaum [3]A Fair Distributed Mutual Exclusion Algorithm, Sandeep Lodha, Ajay Kshemkalyani (IEEE Transactions on Parallel and Distributed Systems archive )Sandeep Lodhajay Kshemkalyaniarchive [4] Sigma: a fault-tolerant mutual exclusion algorithm in dynamic distributed systems subject to process crashes and memory losses,Wei Chen; Shiding Lin; Qiao Lian; Zheng Zhang(This paper appears in: Dependable Computing, Proceedings. 11th Pacific Rim International Symposium )Dependable Computing, Proceedings. 11th Pacific Rim International Symposium [5]Simulations: [6] ASurveyofDistributedMutual ExclusionAlgorithms By MartinG.Velazquez. [7] Distributed Mutual Exclusion Algorithms In Mobile Ad Hoc Networks: An overview* M. Bench~fl"ba 1, A. BouabdaUah 2, N. Badache 1 and M. Ahrned-Nacer 1(ACM publications)