1 Adaptive and Efficient Mutual Exclusion Presented by: By Hagit Attya and Vita Bortnikov Mian Huang.

Slides:



Advertisements
Similar presentations
CS 603 Process Synchronization: The Colored Ticket Algorithm February 13, 2002.
Advertisements

Mutual Exclusion – SW & HW By Oded Regev. Outline: Short review on the Bakery algorithm Short review on the Bakery algorithm Black & White Algorithm Black.
Operating Systems Part III: Process Management (Process Synchronization)
Synchronization. How to synchronize processes? – Need to protect access to shared data to avoid problems like race conditions – Typical example: Updating.
© 2005 P. Kouznetsov Computing with Reads and Writes in the Absence of Step Contention Hagit Attiya Rachid Guerraoui Petr Kouznetsov School of Computer.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
1 Chapter 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld.
Lecture 5 Concurrency and Process/Thread Synchronization     Mutual Exclusion         Dekker's Algorithm         Lamport's Bakery Algorithm.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Chapter 6: Process Synchronization
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Local-spin, Abortable Mutual Exclusion Joe Rideout.
1 Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation.
1 Chapter 3 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
Parallel Processing (CS526) Spring 2012(Week 6).  A parallel algorithm is a group of partitioned tasks that work with each other to solve a large problem.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Local-Spin Algorithms Multiprocessor synchronization algorithms ( ) Lecturer: Danny Hendler This presentation is based on the book “Synchronization.
THIRD PART Algorithms for Concurrent Distributed Systems: The Mutual Exclusion problem.
CPSC 668Set 7: Mutual Exclusion with Read/Write Variables1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Multiprocess Synchronization Algorithms ( )
CPSC 668Set 6: Mutual Exclusion in Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
1 Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation.
Winter School: Hot Topics in Distributed Computing 2010 Algorithms that Adapt to Contention Hagit Attiya (Technion & EPFL)
CPSC 668Set 6: Mutual Exclusion in Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Bakery Algorithm - Proof
CPSC 668Set 8: More Mutex with Read/Write Variables1 CPSC 668 Distributed Algorithms and Systems Fall 2009 Prof. Jennifer Welch.
Concurrency in Distributed Systems: Mutual exclusion.
Local-Spin Algorithms Multiprocessor synchronization algorithms ( ) Lecturer: Danny Hendler This presentation is based on the book “Synchronization.
Synchronization (Barriers) Parallel Processing (CS453)
Faster than Optimal Snapshots (for a While) James Aspnes, Yale University Hagit Attiya, Technion Keren Censor-Hillel, MIT Faith Ellen, University of Toronto.
The Critical Section Problem
Concurrency, Mutual Exclusion and Synchronization.
CSC 211 Data Structures Lecture 13
1 Chapter 10 Distributed Algorithms. 2 Chapter Content This and the next two chapters present algorithms designed for loosely-connected distributed systems.
THIRD PART Algorithms for Concurrent Distributed Systems: The Mutual Exclusion problem.
1 Chapter 10 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
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.
1 Chapter 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
Mutual Exclusion A History. Agenda Model Registers History.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE 668 Set 8: More Mutex with Read/Write Variables 1.
O(log n / log log n) RMRs Randomized Mutual Exclusion Danny Hendler Philipp Woelfel PODC 2009 Ben-Gurion University University of Calgary.
Complexity Implications of Memory Models. Out-of-Order Execution Avoid with fences (and atomic operations) Shared memory processes reordering buffer Hagit.
Physical clock synchronization Question 1. Why is physical clock synchronization important? Question 2. With the price of atomic clocks or GPS coming down,
Max Registers, Counters, and Monotone Circuits Keren Censor, Technion Joint work with: James Aspnes, Yale University Hagit Attiya, Technion (Slides
Asynchronous Exclusive Selection Bogdan Chlebus, U. Colorado Darek Kowalski, U. Liverpool.
Lecture 3 Concurrency and Thread Synchronization     Mutual Exclusion         Dekker's Algorithm         Lamport's Bakery Algorithm.
CPSC 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 6: Mutual Exclusion in Shared Memory 1.
1 Critical Section Problem CIS 450 Winter 2003 Professor Jinhua Guo.
Mutual Exclusion Algorithms. Topics r Defining mutual exclusion r A centralized approach r A distributed approach r An approach assuming an organization.
6.852: Distributed Algorithms Spring, 2008 Class 14.
Atomic snapshots in O(log³ n) steps 1. Snapshot Objects p1p1 p1p1 p2p2 p2p2 pnpn pnpn … … update( v ) scan 2 update your location read all locations.
Bakery Algorithm - Proof
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
O(log n / log log n) RMRs Randomized Mutual Exclusion
O(log n / log log n) RMRs Randomized Mutual Exclusion
Concurrent Distributed Systems
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Multiprocessor Synchronization Algorithms ( )
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Lecture 1: Introduction
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Syllabus 1. Introduction - History; Views; Concepts; Structure
Don Porter Portions courtesy Emmett Witchel
Presentation transcript:

1 Adaptive and Efficient Mutual Exclusion Presented by: By Hagit Attya and Vita Bortnikov Mian Huang

2 Talk Outline  Introduction  Related Work  Preliminaries  Algorithms  Future Work

3 Introduction  Mutual Exclusion Problem  Limitations of most of current solutions  Adaptive solutions  Contributions of this Paper - Adaptive algorithms using only read and write operations that achieve:  Remote step complexity O(k), where k is actual contention  System response time O(log k)  Space complexity  Long-lived renaming - O(nN) where N is the range of processes’ names  One-shot renaming – O(n 2 ) where n is total # of processes

4 Related Work  Dijkstra  Lamport A fast mutual exclusion algorithm  Alur and Taubenfeld Results about fast mutual exclusion  Step complexity could not be adaptive for any asynchronous Algo.  Choy and Singh Adaptive solutions to the mutual exclusion problem  Without assuming hardware-provided synchronization primitives  Performance to be governed solely by # of contending processes

5 Preliminaries  Adaptive algorithms  Point contention (strongest)  Interval contention  Renaming algorithms (getName/releaseName)  Long-lived  One-shot  Non-wait-free algorithms

6 Preliminaries (Cont.)  The Computation Model A standard asynchronous shared-memory model of computation.  n processes  Multi-writer multi-reader registers  shared primitives – atomic read/write registers

7 Preliminaries(Cont.)  The Complexity Measures  Remote step complexity - Max # of shared memory operations performed by a process, where a wait is counted as a single operation  Remote memory references - A stronger version of the above parameter - Assumption of local spin  System response time - The time interval between subsequent entries into the critical section, where a time unit is the min execution interval in which each active process performs at least one step

8 How the Basic Algorithm Works How the Basic Algorithm Works  Architecture  An adaptive long-lived non-wait-free k-renaming  An adaptive tournament tree for mutual exclusion  What it does  A process gets a name in a range of size O(k) using long-lived renaming  Uses this name to enter an adaptive tournament tree for mutual exclusion  The winner of the tournament tree enters the critical section

9 The Basic Algorithm Critical Section Long-Lived Renaming Figure 1. Algorithm Structure Adaptive Tournament Tree

10 Non-Wait-Free Renaming  The basic building block  Filter with an entry point and an exit point  success or fail  Modified filter improves time complexity  An array of n entries  Each entry contains a pointer to a chain of filters/a chain  The name that the process receives is the index of the chain it wins  A chain of filters  Concatenated one after the other  Process succeeds  Process fails - If failed in the r’th filter of the l’th chain, then it skips the next r-1 chains and tries to win in the (l+r)’th chain

Non-Wait-Free Renaming Figure 2. The next chain calculation 0l (r-1) l + r n r’th r-1 2 Filters Chains

12 The code of Basic Algorithm Private variables lastFilter : interger Procedure getName() //get a new name 1. l := 0 2. Index := Repeat 4. l := l + index +1 //calculate next chain to enter 5. := executeChain(l) 6. Until result = win 7. lastFilter := startFilter[l] + index 8. Return l+1 Procedure releaseName(name) // release a name 1. startFilter[name] := lastFilter + 1 Procedure executeChain(l) // access chain l 1. filters := Chains[l][startFilter[l]] 2. curr := 0 3. while (true) 4. if executeFilter(Filters[curr]) = success then 5. if curr > 0 and  Filters[curr-1].c then 6. return 7. else curr else return Figure 3. Adaptive long-lived non-wait-free k-renaming with unbounded memory

13 The code of Basic Algorithm(Cont.) Procedure executeFilter(filter) // access a specific filter 1. if filter.turn   then return fail 2. filter.turn :=id 3. if filter.d then return fail // there is a winner - fail 4. wait until  filter.b or filter.turn  id or filter.d 5. if filter.d then return fail 6. if filter.turn = id then filter.b := true // try to succeed 7. if filter.turn  id then // failing in the filter 8. filter.c := true 9. filter.b := false 10. return fail 11. else // succeeding in the filter 12. filter.d := true 13. return success Figure 3. Adaptive long-lived non-wait-free k-renaming with unbounded memory

14 The Procedures – Basic Algorithm  getName()  Obtains a new name  Invokes procedure executeChain ()  executeChain (l)  Returns a pair:  Executes a filter of a chain  executeFilter(filter)  Modification of the filter suggested by Choy and Singh  Shared variables  releaseName(name)

15 Result of the Algorithm - Filter Properties The following properties ensure that exactly one process eventually remains in the chain and wins it.  Safety If k processes enter the filter, then at most  k/2  processes succeed in it.  Progress If one or more processes enter the filter, then at least one process succeeds in it. Modified filter will also have the property:  Time complexity Some process succeeds in the filter O(1) time units after the first process enters it

16 An execution interval of a process p i includes one iteration of enter, critical section, and exit  If the point contention during p i ‘s execution interval is k, then p i wins in chain l <= k-1  A process wins some chain within O(k) steps Remote step complexity  If k processes enter the chain, then some process wins the chain in  log k  + 2 filters  Some process wins the chain within O(logk) time units after the chain became busy, where k is the point contention of the winner’s execution interval System response time Result of the Algorithm - Chain Properties

17 An Adaptive Tournament Tree  What is it  Is an unbalanced binary tree  Constructed from log N complete binary tree of exponentially growing sizes(1,2,2 2,… nodes) – N is size of name space  Connected by a single path of nodes  Embedded two-process mutual exclusion algorithm with O(1) remote steps- Yang and Anderson

18 An adaptive Tournament Tree A process with a name in the range 0, …, k-1 climbs at most 2logk +1 nodes Root The leaves are numbered from left to right

19 Complexity of the Basic Algorithm  Renaming Algorithm + Tournament Tree  Step complexity: O(k) + O(logk) O(k)  Time complexity: O(logk) + O(logk)O(logk)

20 Bounding The Number of Filters  Basic idea  The number of filters in a chain is bounded by recycling previously used filters  Solutions  A chain of only 2N filters are used cyclically  The process that exits from the critical section detects “slow” processes and promotes them to enter the critical section  In addition, the scan also initializes the recycled filters  Space Complexity of the Renaming Algorithm  Is dominated by the size of array Chains – O(nN)

21 Reducing The Space Complexity  Basic idea  one-shot f(n)-renaming  Complexity of the n-renaming Algorithm  System response time O(logk)  Remote step complexity O(k’), where k’ is the interval contention  Space complexity O(n log n)  Space Complexity of the Mutual Exclusion Algorithm  O(n 2 ) – n times the range of names

22 Summary of Result AlgorithmsRemote Step Complexity System Response Time Space Complexity Choy & Singh O(N)O(k)O(N) Adaptive Bakery Algorithm O(k 4 ) O(N 3 ) Afek et al. O(min(k 2,klogN)) O(k 2 )O(N2 2n ) Anderson & Kim O(k) O(N) Algorithm with long- lived renaming O(k)O(logk)O(nN) Algorithm with one- shot renaming O(k)O(logk)O(n 2 ) Talbe1. Comparison with previous adaptive mutual exclusion algorithms

23 Future Work  Improve the remote step complexity of the algorithm or show that it is optimal  Prove a lower bound on the system response time  Design an algorithm with O(k) remote memory references and O(logk) system response time