Hardware and Software transactional memory and usages in MRE

Slides:



Advertisements
Similar presentations
Transactional Memory Parag Dixit Bruno Vavala Computer Architecture Course, 2012.
Advertisements

Concurrency Control III. General Overview Relational model - SQL Formal & commercial query languages Functional Dependencies Normalization Physical Design.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
© Krste Asanovic, 2014CS252, Spring 2014, Lecture 12 CS252 Graduate Computer Architecture Spring 2014 Lecture 12: Synchronization and Memory Models Krste.
Transactional Memory Supporting Large Transactions Anvesh Komuravelli Abe Othman Kanat Tangwongsan Hardware-based.
Outline CPU caches Cache coherence Placement of data Hardware synchronization instructions Correctness: Memory model & compiler Performance: Programming.
Pessimistic Software Lock-Elision Nir Shavit (Joint work with Yehuda Afek Alexander Matveev)
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)
Transactional Memory Overview Olatunji Ruwase Fall 2007 Oct
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
1 Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory.
Transaction Processing Lecture ACID 2 phase commit.
Distributed Systems 2006 Styles of Client/Server Computing.
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
1 Lecture 23: Transactional Memory Topics: consistency model recap, introduction to transactional memory.
Transaction Management and Concurrency Control
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
Unbounded Transactional Memory Paper by Ananian et al. of MIT CSAIL Presented by Daniel.
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.
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.
KAUSHIK LAKSHMINARAYANAN MICHAEL ROZYCZKO VIVEK SESHADRI Transactional Memory: Hybrid Hardware/Software Approaches.
Highly Available ACID Memory Vijayshankar Raman. Introduction §Why ACID memory? l non-database apps: want updates to critical data to be atomic and persistent.
Reduced Hardware NOrec: A Safe and Scalable Hybrid Transactional Memory Alexander Matveev Nir Shavit MIT.
A Qualitative Survey of Modern Software Transactional Memory Systems Virendra J. Marathe Michael L. Scott.
Low-Overhead Software Transactional Memory with Progress Guarantees and Strong Semantics Minjia Zhang, 1 Jipeng Huang, Man Cao, Michael D. Bond.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Concurrency unlocked Programming
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Solving Difficult HTM Problems Without Difficult Hardware Owen Hofmann, Donald Porter, Hany Ramadan, Christopher Rossbach, and Emmett Witchel University.
Transactional Memory Student Presentation: Stuart Montgomery CS5204 – Operating Systems 1.
Architectural Features of Transactional Memory Designs for an Operating System Chris Rossbach, Hany Ramadan, Don Porter Advanced Computer Architecture.
ECE 1747: Parallel Programming Short Introduction to Transactions and Transactional Memory (a.k.a. Speculative Synchronization)
Novel Paradigms of Parallel Programming Prof. Smruti R. Sarangi IIT Delhi.
Lecture 20: Consistency Models, TM
Maurice Herlihy and J. Eliot B. Moss,  ISCA '93
Outline CPU caches Cache coherence Placement of data
Concurrent programming: From theory to practice
Irina Calciu Justin Gottschlich Tatiana Shpeisman Gilles Pokam
Algorithmic Improvements for Fast Concurrent Cuckoo Hashing
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Part 2: Software-Based Approaches
PHyTM: Persistent Hybrid Transactional Memory
Transaction Management and Concurrency Control
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
The University of Adelaide, School of Computer Science
Changing thread semantics
Lecture 6: Transactions
Chapter 10 Transaction Management and Concurrency Control
Lecture 21: Transactional Memory
Transactional Memory An Overview of Hardware Alternatives
Lecture 22: Consistency Models, TM
Hybrid Transactional Memory
Introduction of Week 13 Return assignment 11-1 and 3-1-5
The University of Adelaide, School of Computer Science
Synchronization on a Parallel Machine Transactional Memory
Lecture 17 Multiprocessors and Thread-Level Parallelism
Lecture 17 Multiprocessors and Thread-Level Parallelism
Programming with Shared Memory Specifying parallelism
Lecture 23: Transactional Memory
Lecture 21: Transactional Memory
Lecture: Consistency Models, TM
Lecture: Transactional Memory
The University of Adelaide, School of Computer Science
Attacking Windows using Intel TSX
Lecture 17 Multiprocessors and Thread-Level Parallelism
Presentation transcript:

Hardware and Software transactional memory and usages in MRE Salishev S.I.

Transactions in Memory Memory transaction is the unitary set of memory accesses Memory transaction is similar to DB transaction, similar ACID props Atomicity requires that each transaction is "all or nothing": if one part of the transaction fails, the entire transaction fails, and the memory state is left unchanged Consistency ensures that any transaction will bring the data in memory from one valid state to another Isolation ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed serially, i.e. one after the other Durability (Optional) Memory is changed only by transactions

Transactions vs. Locks Transactions Locks Speculative + - Safe Nesting Deadlocks Overhead More Less

Transactions and Objects Natural meaning of transactions in asynchronous actor model Transaction Atomic service provided by actor object Consistency, Isolation Guarantee of object Encapsulation Nested Transaction Call to owned object service

Software Transactional Memory Software implementation of memory transactions Implementation is based on Read/Write barriers Control on code side effects Transaction abortion is programmatically controlled Sequential consistency is expected by programmers Problems with reads and data consistency All reads to transactional variables wrapped in transactions Implementation Automatic transactions on all memory accesses Tremendous performance overhead Explicit transactional variable markup Additional work Error prone

Hardware Transactional Memory Extension to MESI cache coherence protocol All memory accesses are transactional Sporadic abortion due to exhausted resources Supported in commercial products Azul Systems Vega 2 Intel Haswell IBM Power8 IBM zEC12 IBM BlueGene/Q

Architecture comparison Nakaike, Takuya, et al. "Quantitative comparison of hardware transactional memory for Blue Gene/Q, zEnterprise EC12, Intel Core, and POWER8." Proceedings of the 42nd Annual International Symposium on Computer Architecture. ACM, 2015.

MESI Protocol

Intel Transactional Synchronization Extensions (TSX) Haswell implements an unordered, single version, nested TM with strong isolation. The TM tracks the read-set and write-set at a fixed 64B cache line granularity. Hardware Lock Elision (HLE) Backward compatible instruction prefixes, which allow speculative execution of critical sections Restricted Transactional Memory (RTM) New synchronization instructions with transactional memory semantics

Hardware Lock Elision (HLE) Acquiring and Releasing a lock are atomic memory write operations ADD, ADC, AND, BTC, BTR, BTS, CMPXCHG, CMPXCHG8B, DEC, INC, NEG, NOT, OR, SBB, SUB, XOR, XADD, and XCHG These operations have LOCK (0xF0) prefix Two new prefixes are provided XACQUIRE and XRELEASE These two prefixes reuse REPNE / REPE prefixes (F2H / F3H) These prefixes were ignored on these opcodes before Haswell XACQUIRE starts the transaction adds lock address to read-set XRELEASE Commits the transaction If transaction aborts it is automatically restated without XACQUIRE

Restricted Transactional Memory (RTM) RTM is a full programmatic assess to the underlying TM XBEGIN offs Starts the transaction, offs is the abort handler relative address XEND Commits the transaction XABORT im8 Aborts the transaction returns error code XTEST Tests if the transaction is executed

Transaction Abort Results EAX Register Bit Position Meaning Set if abort caused by XABORT instruction. 1 If set, the transaction may succeed on a retry. This bit is always clear if bit 0 is set. 2 Set if another logical processor conflicted with a memory address that was part of the transaction that aborted. 3 Set if an internal buffer overflowed. 4 Set if debug breakpoint was hit. 5 Set if an abort occurred during execution of a nested transaction. 23:6 Reserved. 31:24 XABORT argument (only valid if bit 0 set, otherwise reserved).

HTM Limitations Transaction abort due to resource exhaustion Non-conflicting Transactions not guarantied to complete Always need non-HTM fallback False sharing All data in the same cache line is considered atomic False sharing on structure fields and bit fields commonly used in OS’es and File Systems Cache misses due to postponed transaction commit Cannot evict data not committed by transaction Uncommitted data resides in cache taking cache space

HTM Software support HTM-Lock HTM-STM Library HTM transaction with lock based fallback HTM is used for speculative execution of critical sections Lock semantics of user code No transaction support in programming language required Commonly used in Java HTM-STM Library STM transactions with HTM fast-path STM Library semantics of user code Transactional data access through library calls or pragmas transactional_read, transactional_write #pragma tm_atomic Only transactional accesses are transaction safe No durability property Commonly used in C++ Consistent language STM support with HTM fast-path All accesses are transaction safe Durability property Currently consistent language support is only available in functional languages (Haskell, Clojure)

HTM Usages in MRE Speculative Execution of Critical Sections e.g. Azul Vega 2 JVM Java Monitors are converted to transactions Speculative execution of critical sections On abort the old lock path is executed No semantic changes, all deadlocks are ours GC Minimizes synchronization penalty on concurrent reference tracing and updating Hybrid HTM-STM Performance optimization of STM Keeps all implications on changing language semantics