Lecture 1: Introduction Efficient Transformation of Obstruction-free Algorithms into Non-blocking Algorithms Gadi Taubenfeld Obstruction-freedom Non-blocking Wait-freedom DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Efficient Transformation of Obstruction-free Algorithms into Non-blocking Algorithms A note on the use of these ppt slides: I am making these slides freely available to all (faculty, students, readers). They are in PowerPoint form so you can add, modify, and delete slides and slide content to suit your needs. They obviously represent a lot of work on my part. In return for use, I only ask the following: That you mention their source, after all, I would like people to know that I have prepared the presentation. That you note that they are adapted from (or perhaps identical to) my slides, and note my copyright of this material. Thanks and enjoy! Gadi Taubenfeld All material copyright 2007 Gadi Taubenfeld, All Rights Reserved To get the most updated version of these slides go to: http://www.faculty.idc.ac.il/gadi/Publications.htm DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lock-based Data Structures P1 P2 P3 P4 Entry Critical Section Sequential Data Structure Exit Sequential Bottleneck fault-free solution only locks are the de facto mechanism for concurrency control ! DISC 2007 Gadi Taubenfeld © Sept. 2007
Lock-free Data Structures Lecture 1: Introduction Lock-free Data Structures Obstruction-freedom Non-blocking Wait-freedom Fault-tolerant solutions DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Obstruction-freedom P1 P2 P3 P4 Done DISC 2007 Gadi Taubenfeld © Sept. 2007
Lecture 1: Introduction Obstruction-freedom P1 P2 P3 P4 Instruction: click only after process 2 (the slowest) completes one round, otherwise the transition will not be not smooth. DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Non-blocking P1 P2 P3 P4 Instruction: click only after process 3 (the slowest) completes *exectly* one round, in order for the transition to be smooth. Done DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Non-blocking P1 P2 P3 P4 Instruction: click only after process 2 (the slowest) completes one round, otherwise the transition will not be not smooth. DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Wait-freedom P1 P2 P3 P4 Instruction: click only after process 2 (the slowest) completes one round, otherwise the transition will not be not smooth. DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Wait-freedom P1 P2 P3 P4 Done Done Done Done DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lock-free Data Structures Lecture 1: Introduction Lock-free Data Structures Obstruction-freedom Non-blocking Wait-freedom too weak progress condition not complex strong enough not so complex strong/desirable complex/less efficient DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Transformations & Results Lecture 1: Introduction Transformations & Results Obstruction-freedom The FLMS Transformation wait-freedom non-blocking New DISC 2005: Faith Ellen Fich, Victor Luchangco, Mark Moir, Nir Shavit Space: 2n registers + 1 fetch&increment object Our results: Define a time complexity measure Show that the FLMS Transformation is exponential New transformations with O(1) time complexity Space: n registers + 1 compare&swap object DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Transformations & Results Lecture 1: Introduction Transformations & Results Obstruction-freedom Exponential wait-freedom non-blocking O(1) ? Open: Is there an efficient transformation? DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Unknown-bound semi-synchronous model Lecture 1: Introduction Unknown-bound semi-synchronous model There is an unknown bound on memory access time, or Some unknown bound exists on the relative execution rates of any two processes. All practical system satisfy the unknown-bound assumption. A process can delay itself for increasingly longer periods, and by doing so it can ensures that other processes will take enough steps. DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Time complexity (Synchronization complexity) Obstruction-freedom wait-freedom non-blocking The FLMS Transformation New Given an algorithm divide its steps into three disjoint sets: A – synchronization steps; B – real work steps; C – inexpensive steps. Mutual exclusion A – entry + exit ; B – critical section; C – all other steps. Transformations: A – access to shared memory ; B – steps of the obstruction-free alg ; C – all other steps. DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Lecture 1: Introduction Time complexity P1 P2 A process is enabled if its next step or its last step is from B. The max # of steps from A that a process need to take until it becomes enabled since the last time some process has been enabled. time Given an algorithm divide it steps … A – synchronization steps; B – real work steps; C – inexpensive steps. A single run DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
The time complexity of the FLMS transformation Lecture 1: Introduction The time complexity of the FLMS transformation Obstruction-freedom The FLMS Transformation wait-freedom P1 P2 Pn no process is enabled Pn accesses the shared memory at least 2n-1 x n times in this interval. Pn is enabled . . . time A single run DISC 2007 Gadi Taubenfeld © Sept. 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2006
Our Transformation P1 P2 Obstruction-free algorithm Entry Many ideas are from the FLMS paper! P1 P2 We start by assuming a fault-free-model Can use a single lock Expensive when there is no contention Obstruction-free algorithm Entry Critical Section Exit Obstruction-free algorithm DISC 2007 Gadi Taubenfeld © Sept. 2007
Our Transformation P1 P2 Obstruction-free algorithm Entry Many ideas are from the FLMS paper! P1 P2 We start by assuming a fault-free-model Can use a single lock Expensive when there is no contention Obstruction-free algorithm Tries for X steps … Entry Critical Section Exit Obstruction-free algorithm DISC 2007 Gadi Taubenfeld © Sept. 2007
Our Transformation P1 P2 Obstruction-free algorithm Entry Many ideas are from the FLMS paper! P1 P2 We start by assuming a fault-free-model Can use a single lock Expensive when there is no contention Obstruction-free algorithm Tries for X steps … Problem? Entry Critical Section Exit No problem. Obstruction-free algorithm DISC 2007 Gadi Taubenfeld © Sept. 2007
Observation Obstruction-freedom is useful even when using locking! algorithm Entry Critical Section Exit Entry Critical Section Exit Sequential algorithm Obstruction-free algorithm Sequential locking Obstruction-free locking DISC 2007 Gadi Taubenfeld © Sept. 2007
Our Transformation P1 P2 Obstruction-free algorithm Entry Back to the lock-free model P1 P2 The winner increment a counter C every X steps of the OF algorithm. A loser, p, delays itself for C time units. Obstruction-free algorithm if C was updated p delays again, otherwise, p releases the lock. Entry Critical Section Exit Problems: 1. the winner may be alive; 2. two processes hold the lock; 3. p may release the lock at some unexpected time later on. Obstruction-free algorithm DISC 2007 Gadi Taubenfeld © Sept. 2007
Our Transformation P1 P2 Obstruction-free algorithm Entry Solution -- not so simple … P1 P2 The winner tries to acquire the lock again. But, before doing so, it has to wait long enough so that other processes that have mistakenly concluded that it has crashed will have enough time to release the lock again … Obstruction-free algorithm Entry Critical Section Exit Problems: 1. the winner may be alive; 2. two processes hold the lock; 3. p may release the lock at some unexpected time later on. Obstruction-free algorithm DISC 2007 Gadi Taubenfeld © Sept. 2007
The End DISC 2007 Gadi Taubenfeld © Sept. 2007