1 Contention Management and Obstruction-free Algorithms Niloufar Shafiei.

Slides:



Advertisements
Similar presentations
Chapter 7: Deadlocks.
Advertisements

Chapter 7 - Resource Access Protocols (Critical Sections) Protocols: No Preemptions During Critical Sections Once a job enters a critical section, it cannot.
1 Concurrency: Deadlock and Starvation Chapter 6.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Scalable and Lock-Free Concurrent Dictionaries
Wait-Free Reference Counting and Memory Management Håkan Sundell, Ph.D.
Chapter 7: Deadlocks.
Håkan Sundell, Chalmers University of Technology 1 Space Efficient Wait-free Buffer Sharing in Multiprocessor Real-time Systems Based.
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Locality-Conscious Lock-Free Linked Lists Anastasia Braginsky & Erez Petrank 1.
Deadlocks CS 3100 Deadlocks1. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held by another.
Lock-free Cuckoo Hashing Nhan Nguyen & Philippas Tsigas ICDCS 2014 Distributed Computing and Systems Chalmers University of Technology Gothenburg, Sweden.
Transactional Memory Yujia Jin. Lock and Problems Lock is commonly used with shared data Priority Inversion –Lower priority process hold a lock needed.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 8: Deadlocks System Model Deadlock Characterization Methods for Handling Deadlocks.
1 MetaTM/TxLinux: Transactional Memory For An Operating System Hany E. Ramadan, Christopher J. Rossbach, Donald E. Porter and Owen S. Hofmann Presenter:
Obstruction-free synchronization Article by: Maurice Herlihy, Victor Luchangco, Mark Moir Double-Ended Queues as an example Presentation : Or Peri.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
CS510 Advanced OS Seminar Class 10 A Methodology for Implementing Highly Concurrent Data Objects by Maurice Herlihy.
1 Lecture 8: Deadlocks Operating System Spring 2008.
Witawas Srisa-an Chapter 6
CS510 Concurrent Systems Class 13 Software Transactional Memory Should Not be Obstruction-Free.
1 Concurrency: Deadlock and Starvation Chapter 6.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 7: Deadlocks.
Deadlocks Gordon College Stephen Brinton. Deadlock Overview The Deadlock Problem System Model Deadlock Characterization Methods for Handling Deadlocks.
What we will cover…  The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock.
Why The Grass May Not Be Greener On The Other Side: A Comparison of Locking vs. Transactional Memory Written by: Paul E. McKenney Jonathan Walpole Maged.
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
Practical and Lock-Free Doubly Linked Lists Håkan Sundell Philippas Tsigas.
Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
Håkan Sundell, Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers)
Håkan Sundell, Chalmers University of Technology 1 NOBLE: A Non-Blocking Inter-Process Communication Library Håkan Sundell Philippas.
November 15, 2007 A Java Implementation of a Lock- Free Concurrent Priority Queue Bart Verzijlenberg.
Håkan Sundell, Chalmers University of Technology 1 Simple and Fast Wait-Free Snapshots for Real-Time Systems Håkan Sundell Philippas.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks Modified.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 7: Deadlocks.
Optimistic Design 1. Guarded Methods Do something based on the fact that one or more objects have particular states  Make a set of purchases assuming.
1 Distributed Process Management Chapter Distributed Global States Operating system cannot know the current state of all process in the distributed.
Cosc 4740 Chapter 6, Part 4 Deadlocks. The Deadlock Problem A set of blocked processes each holding a resource and waiting to acquire a resource held.
Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.
Verification of obstruction-free algorithm with contention management Niloufar Shafiei.
2001 Networking Operating Systems (CO32010) 1. Operating Systems 2. Processes and scheduling 4.
On the Performance of Window-Based Contention Managers for Transactional Memory Gokarna Sharma and Costas Busch Louisiana State University.
CHAPTER 8: DEADLOCKS System Model Deadlock Characterization
CSE 425: Concurrency II Semaphores and Mutexes Can avoid bad inter-leavings by acquiring locks –Guard access to a shared resource to take turns using it.
A Methodology for Creating Fast Wait-Free Data Structures Alex Koganand Erez Petrank Computer Science Technion, Israel.
Non-Blocking Concurrent Data Objects With Abstract Concurrency By Jack Pribble Based on, “A Methodology for Implementing Highly Concurrent Data Objects,”
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
CS510 Concurrent Systems Why the Grass May Not Be Greener on the Other Side: A Comparison of Locking and Transactional Memory.
Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects Maged M. Michael Presented by Abdulai Sei.
CS6502 Operating Systems - Dr. J. Garrido Deadlock – Part 2 (Lecture 7a) CS5002 Operating Systems Dr. Jose M. Garrido.
CS510 Concurrent Systems Jonathan Walpole. A Methodology for Implementing Highly Concurrent Data Objects.
 The Deadlock Problem  System Model  Deadlock Characterization  Methods for Handling Deadlocks  Deadlock Prevention  Deadlock Avoidance  Deadlock.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
Resource Management Reusable  Disk blocks  File descriptors  Semaphores Consumable  Messages  Packets.
Dr. Kalpakis CMSC 421, Operating Systems Deadlocks.
Styresystemer og Multiprogrammering Block 3, 2005 Deadlocks Robert Glück.
Lecture 12 Handling Deadlock – Prevention, avoidance and detection.
November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg.
CS510 Concurrent Systems Tyler Fetters. A Methodology for Implementing Highly Concurrent Data Objects.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Lecture 7 Operating Systems.
Chapter 8 Deadlocks. Objective System Model Deadlock Characterization Methods for Handling Deadlocks Deadlock Prevention Deadlock Avoidance Deadlock Detection.
Chapter 7: Deadlocks. 7.2CSCI 380 – Operating Systems Chapter 7: Deadlocks The Deadlock Problem System Model Deadlock Characterization Methods for Handling.
CSCI1600: Embedded and Real Time Software Lecture 17: Concurrent Programming Steven Reiss, Fall 2015.
Challenges in Concurrent Computing
Process Deadlocks.
Implementations of obstruction-free algorithms with contention management Niloufar Shafiei.
Software Transactional Memory Should Not be Obstruction-Free
DEADLOCK.
CSCI1600: Embedded and Real Time Software
Presentation transcript:

1 Contention Management and Obstruction-free Algorithms Niloufar Shafiei

2 Agenda  Introduction  Non-blocking approaches  Contention management  Two obstruction-free shared deque algorithms

3 Distributed shared memory systems  Mutual exclusion (using locks)  Delay of processes  Not fault-tolerant (failure of processes)  Deadlock  Priority inversion  Non-blocking  Delay and failure of processes do not cause performance problems

4 Non-blocking  Wait-free All processes complete in a finite number of steps.  Lock-free Some processes complete in a finite number of steps.  Significant overhead  Complex and subtle

5 Non-blocking  Obstruction-free Each process completes if it runs without interference for sufficiently long.  Not guarantee the progress  Simpler  Easier to design

6 Contention management Decide which process can take steps at a time A simple method is back-off when they encounter interference. Contention management policy:  Guarantee the progress of all process

7 + = Contention Management Obstruction-free Algorithms Wait-free Algorithms

8 Contention Management Policies  Aggressive  Always abort  Polite  Exponential back-off  KillBlocked  Abort if an operation is blocked or waits for maximum waiting time  Karma  Set a priority (priority = amount of work + number of retries)

9 Contention Management Policies  Eruption  Set a priority and increase priority of running operation  Randomized  Flip a coin  Kindergarten  Keep a list  Timestamp  Abort earlier timestamp  QueueONBlock  Set a flag of waiting operation

10 Obstruction-free Deque on Linear Array 0 1 … MAX+1 LN … LN RN … RN value counter Invariant: array always consists of at least one LN, followed by zero or more data values, followed by at least one RN.

11 Rightpush(v)  Change the leftmost RN to v 1.Find index of leftmost RN LN … LN RN … RN k

12 2. Check if k=MAX+1 then deque is full 3. Increase the counter of A[k-1] LN … … … … RN K=MAX+1 LN … … RN … RN k A[k-1]

13 4. Change A[k] to v and increase its counter value LN … … v … RN k

14 Rightpop  Change the rightmost data value to RN. 1.Find index of leftmost RN LN LN RN RN k

15 2. Check if deque is empty 3. Increase the counter of A[k] LN LN LN LN RN RN k-1 k LN LN RN RN k A[k]

16 4. Change A[k-1] to RN and increase its counter value and return the popped value LN LN RN RN RN k

17 Problem:  push on one end and pop from the other end LN LN LN LN LN RN

18 Obstruction-free Deque on Circular Array LN RN DN RN LN Invariants: 1.All null values are in a contiguous sequence of locations. 2.The sequence consists of zero or more RN, followed by zero or one DN, followed by zero or more LN. 3.At least two different null values are in the sequence.

19 Rightpush(v)  Change the leftmost RN to v 1.Find index of leftmost RN v1v1 RN DN RN v2v2 LN k

20 2. Read A[k+1]  If A[k+1] = RN v1v1 RN DN RN v2v2 LN k k+1 1.Increase the counter value of A[k-1] 2.Change A[k] to v k-1

21  If A[k+1] = LN v1v1 LN RN v2v2 LN k k+1 1.Increase the counter value of A[k] 2.Change A[k+1] to DN k-1

22  If A[k+1] = DNand A[k+2]  Null v1v1 DN v6v6 RN v2v2 v3v3 v4v4 v5v5 k k+1 Return FULL k-1 k+2

23  If A[k+1] = DNand A[k+2] = LN v1v1 DN LN RN v2v2 v3v3 v4v4 v5v5 k k+1 k-1 k+2 1.Increase the counter value of A[k+2] 2.Change A[k+1] to RN

24 Conclusion  Obstruction-free weakens the progress property but it is simpler.  Contention management policies improve the progress of obstruction-free algorithms.  Obstruction-free algorithms with appropriate contention management policy can perform like wait-free algorithms in practice.