Critical sections (locks) have drawbacks: - if not put at the right level of granularity, they unnecessarily reduce concurrency - delays of one process may affect the whole system **MUTEX-freedom:** the only atomicity is the one provided by the primitives themselves (no wrapping of code into CSs) the liveness properties used so far cannot be used anymore, since they rely on CSs. (example: if we have only atomic R/W registers, these are the only atomic things that we have. But we may also have atomic primitives like *test&set*, *compare&swap* ecc.). #### Liveness properties We have four new liveness properties 1. **Obstruction freedom:** every time an operation is run in isolation (no overlap with any other operation on the same object), it terminates 2. **Non-blocking:** whenever an operation is invoked on an object, eventually one operation on that object terminates - reminds deadlock-freedom in MUTEX-based concurrency 3. **Wait freedom:** whenever an operation is invoked on an object, it eventually terminates - reminds starvation-freedom in MUTEX-based concurrency 4. **Bounded wait freedom:** wait freedom + a bound on the number of steps needed to terminate - reminds bounded bypass in MUTEX-based concurrency *REMARK:* these notions naturally cope with (crash) failures. Fail stop is another way of terminating, there is no way of distinguishing a failure from an arbitrary long sleep (because of asynchrony). ### A wait-free Splitter Assume we have atomic R/W registers. A **splitter** is a concurrent object that provides a single operation **dir** such that: 1. (*validity*) it returns L, R or S (left, right, stop) 2. (*concurrency*) in case of n simultaneous invocations of **dir** 1. at most n-1 L are returned 2. at most n-1 R are returned 3. at most 1 S is returned 3. (*wait freedom*) it eventually terminates. Idea: - not all processes obtain the same value - in a solo execution (i.e., without concurrency) the invoking process must stop (0 L && 0 R && at most 1 S) We have: - DOOR: MRMW boolean atomic register initialized at 1 - LAST: MRMW atomic register initialized at whatever process index ``` dir(i) := LAST <- i if DOOR = 0 then retunr R else DOOR <- 0 if LAST = i then return S else return L ``` With 2 processes, we can have: - one goes left and one goes right - one goes left and the other stops - one goes right and the other stops