Outline Distributed Mutual Exclusion Introduction Performance measures

Slides:



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

CS542 Topics in Distributed Systems Diganta Goswami.
Token-Dased DMX Algorithms n LeLann’s token ring n Suzuki-Kasami’s broadcast n Raymond’s tree.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
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.
CS 582 / CMPE 481 Distributed Systems
Distributed Operating Systems CS551 Colorado State University at Lockheed-Martin Lecture 5 -- Spring 2001.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
Process Synchronization
Synchronization in Distributed Systems. Mutual Exclusion To read or update shared data, a process should enter a critical region to ensure mutual exclusion.
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.
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.
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.
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.
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.
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.
Synchronization Chapter 5.
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.
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.
Synchronization. Clock Synchronization In a centralized system time is unambiguous. In a distributed system agreement on time is not obvious. When each.
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.
COMP 655: Distributed/Operating Systems Summer 2011 Dr. Chunbo Chu Week 6: Synchronyzation 3/5/20161 Distributed Systems - COMP 655.
Distributed Mutual Exclusion Synchronization in Distributed Systems Synchronization in distributed systems are often more difficult compared to synchronization.
Process Synchronization. Objectives To introduce the critical-section problem, whose solutions can be used to ensure the consistency of shared data To.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
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.
Chapter 6 Synchronization Dr. Yingwu Zhu. The Problem with Concurrent Execution Concurrent processes (& threads) often access shared data and resources.
Lecture 11: Coordination and Agreement Central server for mutual exclusion Election – getting a number of processes to agree which is “in charge” CDK4:
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.
Background on the need for Synchronization
Mutual Exclusion Continued
Distributed Mutual Exclusion
Chapter 5: Process Synchronization
Distributed Mutex EE324 Lecture 11.
143a discussion session week 3
Comparison between Suzuki Kasami’s and Raymond’s Tree Algorithm
Distributed Mutual Exclusion
Outline Theoretical Foundations - continued Lab 1
Lecture 2 Part 2 Process Synchronization
Concurrency: Mutual Exclusion and Process Synchronization
CSE 486/586 Distributed Systems Mutual Exclusion
Lecture 10: Coordination and Agreement
Synchronization (2) – Mutual Exclusion
Chapter 6: Synchronization Tools
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:

Outline Distributed Mutual Exclusion Introduction Performance measures Centralized algorithm Non-token-based algorithms Lamport’s algorithm Ricart-Agrawala algorithm Token-based algorithms Suzuki-Kasami’s broadcast algorithm Singhal’s heuristic algorithm Raymond’s tree-based algorithm Comparison 1/11/2019 COP5611

Announcement Next Tuesday (Feb. 18, 2003) Dr. Ted Baker will lecture on distributed deadlock detection (Chapter 7) Please read the materials ahead of time Please review the local deadlock detection algorithms (Chapter 3) I will post his lecture notes on the class web too 1/11/2019 COP5611

The Critical Section Problem When processes (centralized or distributed) interact through shared resources, the integrity of the resources may be violated if the accesses are not coordinated The resources do not record all the changes A process may obtain inconsistent values The final state of the shared resource may be inconsistent 1/11/2019 COP5611

An Example Suppose we have two processes, (one is called producer and the other one consumer), the shared variable counter is 5 initially Producer: counter = counter +1 P1: load counter, r1 P2: add r1, #1, r2 P3: store r2, counter Consumer: counter = counter - 1 C1: load counter, r1 C2: add r1, #-1, r2 C3: store r2, counter 1/11/2019 COP5611

An Example - cont. A particular execution sequence P1: load counter, r1 P2: add r1, #1, r2 --- Context switch ---- C1: load counter, r1 C2: add r1, #-1, r2 C3: store r2, counter P3: store r2, counter What is the value of counter? 1/11/2019 COP5611

An Example - cont. A particular execution sequence C1: load counter, r1 C2: add r1, #-1, r2 --- Context switch ---- P1: load counter, r1 P2: add r1, #1, r2 P3: store r2, counter C3: store r2, counter What is the value of counter this time? 1/11/2019 COP5611

An Example - cont. A particular execution sequence C1: load counter, r1 C2: add r1, #-1, r2 C3: store r2, counter --- Context switch ---- P1: load counter, r1 P2: add r1, #1, r2 P3: store r2, counter What is the value of counter this time? 1/11/2019 COP5611

Mutual Exclusion One solution to the problem is that at any time at most only one process can access the shared resources This solution is known as mutual exclusion A critical section is a code segment in a process which shared resources are accessed A process can have more than one critical section There are problems which involve shared resources where mutual exclusion is not the optimal solution 1/11/2019 COP5611

The Structure of Processes Structure of process Pi repeat entry section critical section exit section reminder section until false; 1/11/2019 COP5611

Mutual Exclusion in Traditional OS Through semaphores, monitors or other programming-language constructs Semaphore S – integer variable can only be accessed via two indivisible (atomic) operations wait (S): while S 0 do no-op; S := S – 1; signal (S): S := S + 1; 1/11/2019 COP5611

Mutual Exclusion in Traditional OS – cont. Shared variables var mutex : semaphore initially mutex = 1 Process Pi repeat wait(mutex); critical section signal(mutex); remainder section until false; 1/11/2019 COP5611

Distributed Mutual Exclusion Due to the absence of shared memory, solutions for mutual exclusion based on shared memory cannot be used in distributed systems It must be based on message passing 1/11/2019 COP5611

Performance Measure for Distributed Mutual Exclusion The number of messages per CS invocation Synchronization delay The time required after a site leaves the CS and before the next site enters the CS System throughput 1/(sd+E), where sd is the synchronization delay and E the average CS execution time Response time The time interval a request waits for its CS execution to be over after its request messages have been sent out 1/11/2019 COP5611

Performance Measure for Distributed Mutual Exclusion 1/11/2019 COP5611

A Centralized Algorithm It is a simple solution One site, called the control site, is responsible for granting permission to the CS execution To request the CS, a site sends a REQUEST message to the control site When a site is done with CS execution, it sends a RELEASE message to the control site The control site queues up the requests for the CS and grant them permission 1/11/2019 COP5611

A Centralized Algorithm – cont. Process 1 asks the coordinator for permission to enter a critical region. Permission is granted Process 2 then asks permission to enter the same critical region. The coordinator does not reply. When process 1 exits the critical region, it tells the coordinator, when then replies to 2 1/11/2019 COP5611

A Centralized Algorithm – cont. Analysis of the centralized algorithm There is a single point of failure Number of messages per CS The synchronization delay System throughput Response time Best case Worst case 1/11/2019 COP5611

Distributed Solutions Non-token-based algorithms Use timestamps to order requests and resolve conflicts between simultaneous requests Lamport’s algorithm and Ricart-Agrawala Algorithm Token-based algorithms A unique token is shared among the sites A site is allowed to enter the CS if it possess the token and continues to hold the token until its CS execution is over; then it passes the token to the next site 1/11/2019 COP5611

Lamport’s Distributed Mutual Exclusion Algorithm This algorithm is based on the total ordering using Lamport’s clocks Each process keeps a Lamport’s logical clock Each process is associated with a unique id that can be used to break the ties In the algorithm, each process keeps a queue, request_queuei, which contains mutual exclusion requests ordered by their timestamp and associated id Ri of each process consists of all the processes The communication channel is assumed to be FIFO 1/11/2019 COP5611

Lamport’s Distributed Mutual Exclusion Algorithm – cont. 1/11/2019 COP5611

Lamport’s Distributed Mutual Exclusion Algorithm – cont. 1/11/2019 COP5611

Lamport’s Distributed Mutual Exclusion Algorithm – cont. 1/11/2019 COP5611

Lamport’s Distributed Mutual Exclusion Algorithm – cont. 1/11/2019 COP5611

Lamport’s Distributed Mutual Exclusion Algorithm – cont. Performance analysis Number of messages per CS Synchronization delay Throughput Response time 1/11/2019 COP5611

Ricart-Agrawala Algorithm 1/11/2019 COP5611

Ricart-Agrawala Algorithm – cont. 1/11/2019 COP5611

Ricart-Agrawala Algorithm – cont. 1/11/2019 COP5611

Ricart-Agrawala Algorithm – cont. Performance analysis Number of messages per CS Synchronization delay Throughput Response time 1/11/2019 COP5611

A Simple Toke Ring Algorithm When the ring is initialized, one process is given the token The token circulates around the ring It is passed from k to k+1 (modulo the ring size) When a process acquires the token from its neighbor, it checks to see if it is waiting to enter its critical section If so, it enters its CS When exiting from its CS, it passes the token to the next Otherwise, it passes the token to the next 1/11/2019 COP5611

A Simple Toke Ring Algorithm – cont. An unordered group of processes on a network. A logical ring constructed in software. 1/11/2019 COP5611

A Simple Toke Ring Algorithm – cont. Performance analysis Number of messages per CS Synchronization delay Response time Problems Lost token Process crash 1/11/2019 COP5611

Suzuki-Kasami’s Algorithm Data structures Each site maintains a vector consisting the largest sequence number received so far from other sites The token consists of a queue of requesting sites and an array of integers, consisting of the sequence number of the request that a site executed most recently 1/11/2019 COP5611

Suzuki-Kasami’s Algorithm – cont. 1/11/2019 COP5611

Suzuki-Kasami’s Algorithm – cont. Performance analysis Number of messages per CS invocation Synchronization delay Response time System throughput 1/11/2019 COP5611

Singhal’s Heuristic Algorithm In this algorithm, each site maintains information about the state of other sites in the system The site only sends the request to a subset of sites that most likely have the token will in a near future This reduces the number of messages per CS execution 1/11/2019 COP5611

Raymond’s Tree-Based Algorithm In this algorithm, sites are logically arranged as a directed tree 1/11/2019 COP5611

Comparison of Distributed Mutual Exclusion Algorithms 1/11/2019 COP5611

Summary Mutual exclusion is one solution to the critical section problem Due to the absence of shared memory, distributed mutual exclusion algorithms are message-based Centralized algorithms Non-token-based algorithms Token-based algorithms 1/11/2019 COP5611