Chapter 10 Mutual Exclusion Presented by Yisong Jiang.

Slides:



Advertisements
Similar presentations
Completeness and Expressiveness
Advertisements

CS 603 Process Synchronization: The Colored Ticket Algorithm February 13, 2002.
Chapter Three: Closure Properties for Regular Languages
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Walks, Paths and Circuits Walks, Paths and Circuits Sanjay Jain, Lecturer, School of Computing.
CprE 458/558: Real-Time Systems (G. Manimaran)1 CprE 458/558: Real-Time Systems Resource Access Control Protocols.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Chapter 15 Basic Asynchronous Network Algorithms
1 Chapter 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
1 Operating Systems, 122 Practical Session 5, Synchronization 1.
CH7 discussion-review Mahmoud Alhabbash. Q1 What is a Race Condition? How could we prevent that? – Race condition is the situation where several processes.
Bounds on Code Length Theorem: Let l ∗ 1, l ∗ 2,..., l ∗ m be optimal codeword lengths for a source distribution p and a D-ary alphabet, and let L ∗ be.
Outline. Theorem For the two processor network, Bit C(Leader) = Bit C(MaxF) = 2[log 2 ((M + 2)/3.5)] and Bit C t (Leader) = Bit C t (MaxF) = 2[log 2 ((M.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Self Stabilization 1.
Problems in Ramsey theory typically ask a question of the form: "how many elements of some structure must there be to guarantee that a particular property.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 6: Mutual Exclusion in Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
CPSC 668Set 6: Mutual Exclusion in Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
CPSC 668Set 10: Consensus with Byzantine Failures1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Bakery Algorithm - Proof
CPSC 668Self Stabilization1 CPSC 668 Distributed Algorithms and Systems Spring 2008 Prof. Jennifer Welch.
CHAPTER 4 Decidability Contents Decidable Languages
13. The Weak Law and the Strong Law of Large Numbers
Concurrency in Distributed Systems: Mutual exclusion.
Prof. Busch - LSU1 Non-regular languages (Pumping Lemma)
Time, Clocks, and the Ordering of Events in a Distributed System Leslie Lamport (1978) Presented by: Yoav Kantor.
The Critical Section Problem
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
PROBABILITY AND STATISTICS FOR ENGINEERING Hossein Sameti Department of Computer Engineering Sharif University of Technology The Weak Law and the Strong.
Mutual Exclusion Presented by: Rohan Sen (Distributed Algorithms Ch. 10)
The Selection Problem. 2 Median and Order Statistics In this section, we will study algorithms for finding the i th smallest element in a set of n elements.
Data Link Protocols Reliable FIFO communication using less reliable channels By Ken Schmidt.
28/10/1999POS-A1 The Synchronization Problem Synchronization problems occur because –multiple processes or threads want to share data; –the executions.
Copyright © Cengage Learning. All rights reserved. CHAPTER 11 ANALYSIS OF ALGORITHM EFFICIENCY ANALYSIS OF ALGORITHM EFFICIENCY.
6.852: Distributed Algorithms Spring, 2008 Class 13.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
Section 2.3 Properties of Solution Sets
1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem.
CSE 5314 On-line Computation Homework 1 Wook Choi Feb/26/2004.
DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE
Mutual Exclusion Using Atomic Registers Lecturer: Netanel Dahan Instructor: Prof. Yehuda Afek B.Sc. Seminar on Distributed Computation Tel-Aviv University.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE 668 Set 8: More Mutex with Read/Write Variables 1.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
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.
Chapter 11 Resource Allocation by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
CS 203: Introduction to Formal Languages and Automata
Chapter 21 Asynchronous Network Computing with Process Failures By Sindhu Karthikeyan.
Lecture 21 Reducibility. Many-one reducibility For two sets A c Σ* and B c Γ*, A ≤ m B if there exists a Turing-computable function f: Σ* → Γ* such that.
Section 3.2: Sequences and Summations. Def: A sequence is a function from a subset of the set of integers (usually the set of natural numbers) to a set.
Fault tolerance and related issues in distributed computing Shmuel Zaks GSSI - Feb
Program Correctness. The designer of a distributed system has the responsibility of certifying the correctness of the system before users start using.
“Towards Self Stabilizing Wait Free Shared Memory Objects” By:  Hopeman  Tsigas  Paptriantafilou Presented By: Sumit Sukhramani Kent State University.
CPSC 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 6: Mutual Exclusion in Shared Memory 1.
Decentralized solution 1
1 Distributed Vertex Coloring. 2 Vertex Coloring: each vertex is assigned a color.
6.852: Distributed Algorithms Spring, 2008 Class 14.
Theory of Computational Complexity M1 Takao Inoshita Iwama & Ito Lab Graduate School of Informatics, Kyoto University.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Bakery Algorithm - Proof
Non-regular languages
PROPERTIES OF REGULAR LANGUAGES
Chapter 5. Optimal Matchings
Decentralized solution 1
Mutual Exclusion Problem Specifications
Mutual Exclusion CS p0 CS p1 p2 CS CS p3.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Presentation transcript:

Chapter 10 Mutual Exclusion Presented by Yisong Jiang

Mutual Exclusion Using Read- Modify-Write Shared Variables In this section, we consider mutual exclusion using read-modify-write shared memory. That is, a process is able, in one instantaneous step, to access a shared variable and to use the variable value and the process state to determine a new variable value and a new process state.

Mutual Exclusion Using Read- Modify-Write Shared Variables The basic problem TrivialME: In this algorithm, the shared variable x has value 1 exactly if the resource has been granted to some process. Any process in the trying region simply tests x until it discovers x =0, at which time it immediately sets x:=1. Upon exiting, a process resets x:=0 See Page 310 for the TrivialME algorithm

Mutual Exclusion Using Read- Modify-Write Shared Variables Bounded Bypass The TrivialME algorithm does not guarantee any high-level-fairness conditions. However, we can obtain very strong high-level-fairness conditions, even a FIFO condition, still just using a single shared variable.

Mutual Exclusion Using Read- Modify-Write Shared Variables QueueME algorithm: The processes maintain a queue of process indices, initially empty, in the shared variable. A process that enters T adds its index to eht end of the queue; a process that finds itsself at the beginning of the queue goes to C; and when a process leaves C, it deletes itself from the queue. See Page 311 for the QueueME algorithm

Mutual Exclusion Using Read- Modify-Write Shared Variables QueueME guarantees well-formedness, mutual exclusion, and progress. Moreover, it satisfies the high-level-fairness condition that entry to the critical region is FIFO with respect to the first locally controlled action in the trying region. This implies that QueueME guarantees bounded bypass( with a bound of 1) Theorem QueueME solves the mutual exclusion problem and guarantees bounded bypass

Mutual Exclusion Using Read- Modify-Write Shared Variables For the QueueME, the shared variable requires Ω(nlogn) bits. It is not very hard to achieve the same type of FIFO behavior as the QueueME algorithm, using a shared variable with only n 2 values(2logn bits). TicketME algorithm ( see page 313)

Mutual Exclusion Using Read- Modify-Write Shared Variables

Theorem TicketME solves the mutual exclusion problem and guarantees bounded bypass, using n 2 values of shared memory. A simulation proof We relate the TicketME algorithm to a new Infinite TicketME algorithm that is just like TicketME except that it uses an infinite sequence of tickets rather than counting modulo n. Then TicketME can be seen as a reduced-complexity version of Infinite TicketME(page 322).

Mutual Exclusion Using Read- Modify-Write Shared Variables

Lemma f is a simulation relation from T to I Proof: For the first condition, a start state s of T consists of th unique start state of the TicketME algorithm and arbitrary start states for the users. It is easy to see that the unique start state of the Infinite TicketMe algorithm, together with the same start states for the users, is in f(s) The second condition is proved by a case analysis, according to the type of action being performed

Mutual Exclusion Using Read- Modify-Write Shared Variables Proof Sketch of Theorem Lemma and Theorem 8.12 imply that traces(T) Є traces(I). So the fact that these 3 conditions hold for I implies that they also hold for T. This implies that TicketME guarantees the well-formednes, mutual exclusion, and FIFO conditions. To prove the progress condition, we argue fairtraces(T) Є fairtraces(I). Let  Є fairtraces(T) and let  be any fair execution of T such that  trace(  ). Then by theorem 8.13, there is a corresponding execution  ’ of I satisgying the two conditions enumerated above. In particular, the traces of  and  ’ are the same, so that  trace(  ’). We claim  ’ is a fair execution of I.

Mutual Exclusion Using Read- Modify-Write Shared Variables It follows that  ’ is a fair execution of I, which implies that  Є fairtraces(I). Thus fairtraces(T) Є fairtraces(I). Since the progress condition can be expressed as a property of fair traces, this implies that the progress condition carries over from Infinite TicketME to TicketME.

Mutual Exclusion Using Read- Modify-Write Shared Variables Theorem Let A be an n-process mutual exclusion algorithm guaranteeing bounded bypass, using a single read-modify- write variable. Then the number of distinct values the variable can take on is at least n

Mutual Exclusion Using Read- Modify-Write Shared Variables Proof Suppose A is an n-process mutual exclusion algorithm guaranteeing bounded bypass, with a bypass bound of a. We proceed by contradiction: we construct an execution in which some process is bypassed more than a times We start by defining a sequence of finite executions, α1, α2,……, αn, each an extension of the previous one. Execution α1 is obtained by letting process 1 run alone from an initial system state until it enters C.

Mutual Exclusion Using Read- Modify-Write Shared Variables To obtain α2, we extend α1 by letting process 2 enter the trying region and take one locally controlled step. Process 2 must remain in its trying region after α2, in order to avoid the mutual exclusion condition. Each process I, 3<=i<=n, also remains in its trying region. Define si to be the system state and vi the value of the shared variable after αi, 1<=i<=n. We claim that vi ≠ vj for 1<=I, j<=n, i ≠ j, which implies the result.

Mutual Exclusion Using Read- Modify-Write Shared Variables

Assume the contrary, that vi = vj for some particular I and j, I ≠ j, and assume i<j. then si and sj are indistinguishable to process k for every process k, k<=1<=I Now, there is some low-level-fair execution that extends αi, involving only processes 1,…, I, that causes some process to enter C infinitely many times. The same steps can be applied after αj, again yielding an execution in which the same process enters C infinitely many times. Just running a sufficiently large portion of this execution is enough to cause process j to by bypassed more than a times by some other process, which is a contradiction.

Mutual Exclusion Using Read- Modify-Write Shared Variables A counterexample algorithm that only requires O(n) values. BufferMainME algorithm: Basic Idea: The trying region is divided into two pieces, called the buffer region and the main region. When processes enter the trying region, they go in to the buffer; no order information is maintained among the processes in the buffer. At some time, when the main region is empty, all processes in the buffer go to the main region, thereby emptying the buffer. From the main region, processes go one at a time, in arbitrary order, to the critical region.

Mutual Exclusion Using Read- Modify-Write Shared Variables Theorem The BufferMainME algorithm solves the mutual exclusion problem, guaranteeing bounded bypass, using a single read-modify-write shared variable with only n+k values( for some small constant k)

Mutual Exclusion Using Read- Modify-Write Shared Variables Lockout-Freedom The lower bound of Theorem only holds when the high-level-fairness requirement is bounded bypass. It does not hold for lock-out freedom. We have another counterexample: Executive algorithm. Executive algorithm: (see page 319) The idea is as follows: As in the BufferMainME, each incoming process increments a count in the shared variable, but this time the count is only allowed to take on Values 0,…n/2 before wrapping back around to 0. The count is absorbed by a supervisor, as before.

Mutual Exclusion Using Read- Modify-Write Shared Variables Theorem The Executive algorithm solves the mutual exclusion problem, guaranteeing lockout-freedom, using a single read-modify-write shared variable with only n/2+k values.