CS510 Concurrent Systems Class 13 Software Transactional Memory Should Not be Obstruction-Free.

Slides:



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

Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
Database Systems (資料庫系統)
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
Practice Session 7 Synchronization Liveness Deadlock Starvation Livelock Guarded Methods Model Thread Timing Busy Wait Sleep and Check Wait and Notify.
Concurrency: Deadlock and Starvation Chapter 6. Deadlock Permanent blocking of a set of processes that either compete for system resources or communicate.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 Concurrency Control Chapter 17 Sections
CS6223: Distributed Systems
Lock-Based Concurrency Control
Software Transactional Memory Should Not Be Obstruction Free Robert Ennals Intel Research Cambridge 15 JJ Thomson Avenue, Cambridge, CB3 0FD, UK
Hybrid Transactional Memory Nir Shavit MIT and Tel-Aviv University Joint work with Alex Matveev (and describing the work of many in this summer school)
COS 461 Fall 1997 Transaction Processing u normal systems lose their state when they crash u many applications need better behavior u today’s topic: how.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
TOWARDS A SOFTWARE TRANSACTIONAL MEMORY FOR GRAPHICS PROCESSORS Daniel Cederman, Philippas Tsigas and Muhammad Tayyab Chaudhry.
Transactional Memory Yujia Jin. Lock and Problems Lock is commonly used with shared data Priority Inversion –Lower priority process hold a lock needed.
Synchronization. Physical Clocks Solar Physical Clocks Cesium Clocks International Atomic Time Universal Coordinate Time (UTC) Clock Synchronization Algorithms.
OS Spring 2004 Concurrency: Principles of Deadlock Operating Systems Spring 2004.
CS510 Concurrent Systems Class 2 A Lock-Free Multiprocessor OS Kernel.
Transaction Management
OS Fall’02 Concurrency: Principles of Deadlock Operating Systems Fall 2002.
TxLinux: Using and Managing Hardware Transactional Memory in an Operating System Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan,
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan, Aditya Bhandari, and Emmett Witchel - Presentation By Sathish P.
Software Transaction Memory for Dynamic-Sized Data Structures presented by: Mark Schall.
G Robert Grimm New York University Scheduler Activations.
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.
I/O Systems ◦ Operating Systems ◦ CS550. Note:  Based on Operating Systems Concepts by Silberschatz, Galvin, and Gagne  Strongly recommended to read.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
CS510 Concurrent Systems Jonathan Walpole. A Lock-Free Multiprocessor OS Kernel.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Operating Systems Distributed Coordination. Topics –Event Ordering –Mutual Exclusion –Atomicity –Concurrency Control Topics –Event Ordering –Mutual Exclusion.
Chapter 11 Concurrency Control. Lock-Based Protocols  A lock is a mechanism to control concurrent access to a data item  Data items can be locked in.
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 Contention Management and Obstruction-free Algorithms Niloufar Shafiei.
Overview of DBMS recovery and concurrency control: Eksemplerne er fra kapitel 3 I bogen: Lars Fank Databaser Teori og Praksis ISBN
A Methodology for Creating Fast Wait-Free Data Structures Alex Koganand Erez Petrank Computer Science Technion, Israel.
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.
Chapter 15: Transactions Loc Hoang CS 157B. Definition n A transaction is a discrete unit of work that must be completely processed or not processed at.
7c.1 Silberschatz, Galvin and Gagne ©2003 Operating System Concepts with Java Module 7c: Atomicity Atomic Transactions Log-based Recovery Checkpoints Concurrent.
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
CS510 Concurrent Systems Jonathan Walpole. A Methodology for Implementing Highly Concurrent Data Objects.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
CS510 Concurrent Systems Jonathan Walpole. RCU Usage in Linux.
CS333 Intro to Operating Systems Jonathan Walpole.
AtomCaml: First-class Atomicity via Rollback Michael F. Ringenburg and Dan Grossman University of Washington International Conference on Functional Programming.
MULTIVIE W Slide 1 (of 21) Software Transactional Memory Should Not Be Obstruction Free Paper: Robert Ennals Presenter: Emerson Murphy-Hill.
Optimistic Design CDP 1. Guarded Methods Do something based on the fact that one or more objects have particular states Make a set of purchases assuming.
Transactions and Reliability
Transaction Management
Background on the need for Synchronization
Part 2: Software-Based Approaches
Concurrency Control.
Advanced Operating Systems - Fall 2009 Lecture 8 – Wednesday February 4, 2009 Dan C. Marinescu Office: HEC 439 B. Office hours: M,
A Qualitative Survey of Modern Software Transactional Memory Systems
Outline Announcements Fault Tolerance.
Chapter 10 Transaction Management and Concurrency Control
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E
Chapter 15 : Concurrency Control
Concurrency: Mutual Exclusion and Process Synchronization
Software Transactional Memory Should Not be Obstruction-Free
Locking Protocols & Software Transactional Memory
CONCURRENCY Concurrency is the tendency for different tasks to happen at the same time in a system ( mostly interacting with each other ) .   Parallel.
CSE 542: Operating Systems
CSE 542: Operating Systems
Presentation transcript:

CS510 Concurrent Systems Class 13 Software Transactional Memory Should Not be Obstruction-Free

What is Obstruction Freedom?  Weakest of the series of properties o wait-free – every process must complete an operation after a finite number of steps (i.e. no starvation) o lock-free – some process must complete an operation after a finite number of steps (i.e. no system-wide blocking) o obstruction-free - a process is guaranteed to make progress when all other processes are stopped (i.e. no blocking by inactive processes) CS510 - Concurrent Systems 2

Why is Obstruction Freedom Useful?  Distributed systems have independent failure domains o obstruction freedom stops failed CPUs from preventing progress on healthy CPUs  But is it useful in shared memory multi-core systems with a single failure domain? o existing multi-core applications do not have this property do they need it? o is STM interesting because of its obstruction freedom property, or for some other reason? CS510 - Concurrent Systems 3

Causes of Obstruction?  Threads become inactive for long periods due to: o Failures o Scheduling policies o Blocking operations o Priority inversions  How are each of these situations handled in non- STM systems? CS510 - Concurrent Systems 4

Why is Obstruction Freedom Expensive?  Because it precludes accessing object data in-place! o Requires extra memory accesses for a level of indirection must go via an object descriptor to get to the object data o Results in poor use of cache and TLB  What if one process wants to access an object owned (being written to) by a swapped-out process? o Wait? but that’s not obstruction-free! o Go ahead? but that’s not safe o Abort the blocked process and wait for acknowledgement? but that’s not obstruction-free either (may live-lock) CS510 - Concurrent Systems 5

Indirection in Obstruction-Free STM CS510 - Concurrent Systems 6

Why is Obstruction Freedom Expensive?  Because it results in an excessive number of active transactions o this increases memory contention  If there are N transactions on N processors, what happens if we want to start another transaction o Obstruction-free implementations can’t wait for other transactions to complete, so memory contention must increase CS510 - Concurrent Systems 7

Converting Existing Code to STM  Threading for convenience o convert lock-protected critical sections to transactions  Threading for performance o match number of active threads to number of CPUs o convert lock-protected critical sections to transactions o poor mapping of threads to CPUs not solved by STM! CS510 - Concurrent Systems 8

STM Without Obstruction Freedom  Revocable Two Phase Locking for Writes o A transaction locks all objects it intends to write o Locks are released when transaction completes o On deadlock, one transaction aborts and rolls back it’s writes  Optimistic Concurrency Control for Reads o Objects log the version number they read o Version numbers must match end-of-transaction version numbers on commit o if no match, retry o like sequence locks in Linux CS510 - Concurrent Systems 9

Memory Layout CS510 - Concurrent Systems 10

Writing  If the object’s handle is a version number o CAS handle to point to new write descriptor object is now locked o Make private working copy of data why? Aborts, concurrent reads, …  If the object’s handle is a write descriptor, wait o Until it is a version number (ie until its unlocked) o Or a timeout has been reached, then request other process to abort (if its lower priority than you)  On deadlock, system aborts one transaction CS510 - Concurrent Systems 11

Reading  To read from an object o Wait for handle to become a version wait until its unlocked once it is, proceed optimistically (i.e. without read locking it!) o Log the version number so you can tell if you need to retry CS510 - Concurrent Systems 12

Committing  Make sure all read objects still have same version (check)  Write working copy to original object (update)  Set object’s descriptor to a new version (unlock) CS510 - Concurrent Systems 13

Performance (1) CS510 - Concurrent Systems 14

Performance (2) CS510 - Concurrent Systems 15

Performance (3) CS510 - Concurrent Systems 16

Why the Poor Performance?  Obstruction-Freedom effect on cache and TLB o inability to co-locate data and meta-data in memory such that they map to the same cache line o impacts performance in the uncontended case  Helping o occurs in the contended case o contending transactions help others to finish o transactions slow each other down more and more as the number of transactions involved in helping increases CS510 - Concurrent Systems 17

Conclusion  Obstruction freedom is not important to software transactional memory systems  Obstruction freedom makes implementations: o Inefficient o Complicated  Remove it from the requirements list! CS510 - Concurrent Systems 18