CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.

Slides:



Advertisements
Similar presentations
Concurrent programming for dummies (and smart people too) Tim Harris & Keir Fraser.
Advertisements

Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
1 Concurrency Control Chapter Conflict Serializable Schedules  Two actions are in conflict if  they operate on the same DB item,  they belong.
1 Lecture 11: Transactions: Concurrency. 2 Overview Transactions Concurrency Control Locking Transactions in SQL.
Software Transactional Memory and Conditional Critical Regions Word-Based Systems.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Lock-Based Concurrency Control
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Rich Transactions on Reasonable Hardware J. Eliot B. Moss Univ. of Massachusetts,
Virendra J. Marathe, William N. Scherer III, and Michael L. Scott Department of Computer Science University of Rochester Presented by: Armand R. Burks.
Software Transactional Memory Kevin Boos. Two Papers Software Transactional Memory for Dynamic-Sized Data Structures (DSTM) – Maurice Herlihy et al –
Lecture 11 Recoverability. 2 Serializability identifies schedules that maintain database consistency, assuming no transaction fails. Could also examine.
Ali Saoud Object Based Transactional Memory. Introduction Resent trends go towards object based SMT because it’s dynamic Word-based STM systems are more.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
TOWARDS A SOFTWARE TRANSACTIONAL MEMORY FOR GRAPHICS PROCESSORS Daniel Cederman, Philippas Tsigas and Muhammad Tayyab Chaudhry.
Computer Science Lecture 12, page 1 CS677: Distributed OS Last Class Distributed Snapshots –Termination detection Election algorithms –Bully –Ring.
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
EPFL - March 7th, 2008 Interfacing Software Transactional Memory Simplicity vs. Flexibility Vincent Gramoli.
10 1 Chapter 10 Transaction Management and Concurrency Control Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Transaction Management and Concurrency Control
Transaction Management and Concurrency Control
1 Lecture 24: Transactional Memory Topics: transactional memory implementations.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
Transaction Management
CS510 Concurrent Systems Class 13 Software Transactional Memory Should Not be Obstruction-Free.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
Software Transaction Memory for Dynamic-Sized Data Structures presented by: Mark Schall.
9 Chapter 9 Transaction Management and Concurrency Control Hachim Haddouti.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
An Introduction to Software Transactional Memory
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 10 Transaction Management.
1cs Intersection of Concurrent Accesses A fundamental property of Web sites: Concurrent accesses by multiple users Concurrent accesses intersect.
A Qualitative Survey of Modern Software Transactional Memory Systems Virendra J. Marathe Michael L. Scott.
Databases Illuminated
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
TRANSACTION MANAGEMENT R.SARAVANAKUAMR. S.NAVEEN..
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.
Lowering the Overhead of Software Transactional Memory Virendra J. Marathe, Michael F. Spear, Christopher Heriot, Athul Acharya, David Eisenstat, William.
Why STMs Need Compilers (a war story) Maurice Herlihy Brown University.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Page 1 Concurrency Control Paul Krzyzanowski Distributed Systems Except as otherwise noted, the content of this presentation.
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
9 1 Chapter 9_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
NOEA/IT - FEN: Databases/Transactions1 Transactions ACID Concurrency Control.
MULTIVIE W Slide 1 (of 21) Software Transactional Memory Should Not Be Obstruction Free Paper: Robert Ennals Presenter: Emerson Murphy-Hill.
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
©Bob Godfrey, 2002, 2005 Lecture 17: Transaction Integrity and Concurrency BSA206 Database Management Systems.
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.
Transactional Memory Student Presentation: Stuart Montgomery CS5204 – Operating Systems 1.
18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain? Enable n-tier architectures while not necessarily using.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.

Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer III
Maurice Herlihy and J. Eliot B. Moss,  ISCA '93
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Part 2: Software-Based Approaches
Transaction Management and Concurrency Control
Maurice Herlihy, Victor Luchangco, Mark Moir, William N. Scherer III
A Qualitative Survey of Modern Software Transactional Memory Systems
Changing thread semantics
Chapter 10 Transaction Management and Concurrency Control
Part 1: Concepts and Hardware- Based Approaches
Hybrid Transactional Memory
Introduction of Week 13 Return assignment 11-1 and 3-1-5
Software Transactional Memory Should Not be Obstruction-Free
Lecture 23: Transactional Memory
Presentation transcript:

CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches

Transactional Memory 2 CS 5204 – Operating Systems Word-based STM (Shavit&Touitou) Guarantees lock-freedom Uses a non-recursive “helping” strategy Limitations  Static transactions: ownership must be acquired in some total order to avoid livelock  Memory costs  Helping requires transaction to yield same results under multiple (partial) executions Basic transaction process: 1.Read old values into transaction record 2.Acquire ownership of memory location for each value a.Succeed: Perform transaction; update memory; release ownership. b.Fail: release ownership; help if not already helping (non-recursive); abort.

Transactional Memory 3 CS 5204 – Operating Systems Word-based STM (WSTM): Harris&Fraser Multiple addresses map to the same ownership record. Logical state: a (value, version) pair representing the contents of a memory location. Ownership record stores either version number of address or transaction descriptor. Read/write operations create entries in a transaction descriptor. Commit operation attempts to gain ownership of the locations it reads/writes by placing the address of its transaction descriptor in the ownership records. Guarantees obstruction-free execution.

Transactional Memory 4 CS 5204 – Operating Systems Stealing Transaction attempting to commit, “steals” transaction entry from conflicting transaction Provides non-blocking commit operation (guarantee of obstruction-free execution) Requires ownership record to store the number of transaction holding a transaction record for a location mapping to the ownership record

Transactional Memory 5 CS 5204 – Operating Systems Language Support Conditional Critical Region (CCR) Translation : boolean done = false; while (!done) { STMStart(); try { if (condition) { statements; done = STMCommit(); } else { STMWait(); } catch (Throwable t) { done = STMCommit(); if (done) { throw t; } Syntax: atomic (condition) { statements; } conditional critical region syntax added to Java source-to-bytecode compiler handles translation of atomic blocks and creates separate method of each atomic block methods of data access provide STMRead and STMWrite for methods defined for atomic blocks

Transactional Memory 6 CS 5204 – Operating Systems Performance WSTM is superior to simple synchronization schemes (CCR vs. S-1) on few processors WSTM is competitive with sophisticated synchronization schemes (CCR vs. FG-1) on few processors WSTM is superior to other synchronization schemes on large number of processors

Transactional Memory 7 CS 5204 – Operating Systems Dynamic STM (DTSM): Herlihy et.al. TMObject is a handle for an object. An “open” operation on the TMObject is required before object can be accessed. Transaction state may be: ACTIVE, COMMITTED, ABORTED. The “current” form of the object data is maintained (Old Object). A shadow copy of to-be-committed updates to the object is also maintained. TM Object Transaction New Object Old Object Locator Transaction object data

Transactional Memory 8 CS 5204 – Operating Systems Opening a TMObject for Writing Transaction New Object Old Object Locator T2: Active object data TM Object Transaction New Object Old Object Locator T1: Committed object data Copy CAS

Transactional Memory 9 CS 5204 – Operating Systems Opening a TMObject for Writing Transaction New Object Old Object Locator T2: Active object data TM Object Transaction New Object Old Object Locator T1: Aborted object data Copy CAS

Transactional Memory 10 CS 5204 – Operating Systems Opening a TMObject for Writing one of T1 or T2 must abort to resolve conflict without blocking each thread has a ContentionManager  aggressive – always/immediately aborts conflicting transaction  polite – adaptive back-off contention reduced by “early release”  reference to object dropped before transaction commits  releasing transaction must insure that subsequent changes to the released object does not jeopardize consistency TM Object Transaction New Object Old Object Locator T1: Active object data T2: Active open for writing

Transactional Memory 11 CS 5204 – Operating Systems Opening a TMObject for Reading TM Object Transaction New Object Old Object Locator T1: Committed object data T2: Active read-only list object value next Transaction

Transactional Memory 12 CS 5204 – Operating Systems Performance STM versions competitive with simple locking scheme Aggressive contention management can cause performance to collapse under high contention

Transactional Memory 13 CS 5204 – Operating Systems Performance By lowering contention, early release sustains performance of aggressive contention management. Contention management useful and has possibly complex relationship to data structure design.

Transactional Memory 14 CS 5204 – Operating Systems FSTM: Fraser Objects are accessed by an open operation on the object header An object may be open in multiple transactions at the same time Transaction maintains an object handle for each open object Object handles are organized into two lists: a read-only list and a read-write list For each writeable object the transaction maintains a shadow copy of the object private to the transaction Conflicts among transactions are detected and resolved at commit-time Guarantees lock-freedom

Transactional Memory 15 CS 5204 – Operating Systems Commit operation in FTSM PhaseDescription Acquire Action: Acquire each object in the read-write list in global total order using atomic CAS for each object Outcomes: Abort if conflict with committed transaction detected Help if conflict with uncommitted transaction detected Read-checking Action: Verify consistency of each object in the read-only list Outcomes: Abort if change is detected in object held by Undecided transaction If conflict detected with Read-checking transaction:  Help if other transaction precedes current transaction  Abort if current transaction precedes other transaction Release Release each acquired object

Transactional Memory 16 CS 5204 – Operating Systems Comparison Criteria* Strong or Weak Isolation  Weak isolation: conflicting operation outside of a transaction may not follow the STM protocols  Strong isolation: all conflicting operations are (converted to) execute in transactions Transaction Granularity  Word: conflicts detected at word level  Block: conflicts detected at block level Direct of Deferred Update  Direct: memory is updated by transaction and restored to original value on abort  Deferred: updates are stored privately and applied to memory on commit Update in place: private values copied to memory Cloned replacement: private copy replaces original memory Concurrency control  Pessimistic: conflict is immediately detected and resolved  Optimistic: conflict detection and/or resolution deferred Synchronization  Blocking  Non-blocking (wait-, lock-, obstruction-freedom) * From: Transactional Memory, James Larus and Ravi Rajwar

Transactional Memory 17 CS 5204 – Operating Systems Comparison Criteria* (cont.) Conflict Detection  Early: conflicts detected on open/acquire or by explicit validation  Late: conflicts detected at time of commit operation Inconsistent reads  Validation: check for updates to memory being read  Invalidation: abort reading transaction when update is made  Toleration: allow inconsistency (expecting subsequent validation/abort) Conflict resolution  System-defined: help or abort conflicting transactions  Application-defined: contention manager resolves conflicts Nested Transactions  Flattened: aborting inner transaction aborts outer transaction - inner transaction only commits when outer transaction commits  Not-Flattened: aborting inner transaction does not cause outer transaction to abort Closed: effects of inner transaction not visible to other transaction until outer transaction commits (rollback possible) Open: effects of inner transaction visible to other transaction when inner transaction commits (rollback not possible) Exceptions  Terminate: a commit operation is attempted when an exception occurs in the transaction before propagating the exception  Abort: the transaction is aborted * From: Transactional Memory, James Larus and Ravi Rajwar

Transactional Memory 18 CS 5204 – Operating Systems Comparison Characteristic System STM-1WSTMDSTMFSTM Strong/Weak IsolationN/AWeak GranularityWord Object Direct/Deferred UpdateDirectDeferred (update in place) Deferred (clone replacement) Concurrency ControlPessimisticOptimistic SynchronizationLock-freeObstruction-free Lock-free Conflict DetectionEarlyLateEarlyLate Inconsistent ReadsNoneTolerationValidation Conflict ResolutionHelpingHelping/abortingContention manager Abort Nested TransactionsFlattened Closed ExceptionsTerminate