Transactional Memory Student Presentation: Stuart Montgomery CS5204 – Operating Systems 1.

Slides:



Advertisements
Similar presentations
Inferring Locks for Atomic Sections Cornell University (summer intern at Microsoft Research) Microsoft Research Sigmund CheremTrishul ChilimbiSumit Gulwani.
Advertisements

Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories.
Transactional Memory Parag Dixit Bruno Vavala Computer Architecture Course, 2012.
Maurice Herlihy (DEC), J. Eliot & B. Moss (UMass)
Mohamed. M. Saad Mohamed A. Mohamedin & Prof. Binoy Ravindran VT-MENA Program Electrical & Computer Engineering Department Virginia Polytechnic Institute.
Software Transactional Memory and Conditional Critical Regions Word-Based Systems.
ECE 454 Computer Systems Programming Parallel Architectures and Performance Implications (II) Ding Yuan ECE Dept., University of Toronto
Transactional Locking Nir Shavit Tel Aviv University (Joint work with Dave Dice and Ori Shalev)
Transactional Memory Supporting Large Transactions Anvesh Komuravelli Abe Othman Kanat Tangwongsan Hardware-based.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Rich Transactions on Reasonable Hardware J. Eliot B. Moss Univ. of Massachusetts,
Transactional Memory Part 1: Concepts and Hardware- Based Approaches 1Dennis Kafura – CS5204 – Operating Systems.
1 Hardware Transactional Memory Royi Maimon Merav Havuv 27/5/2007.
Transactional Memory: Architectural Support for Lock- Free Data Structures Herlihy & Moss Presented by Robert T. Bauer.
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.
Copyright © 2006, CS 612 Transactional Memory Architectural Support for a Lock-Free Data Structure Some material borrowed from : Konrad Lai, Microprocessor.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
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.
1 Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory.
[ 1 ] Agenda Overview of transactional memory (now) Two talks on challenges of transactional memory Rebuttals/panel discussion.
Lock vs. Lock-Free memory Fahad Alduraibi, Aws Ahmad, and Eman Elrifaei.
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
EPFL - March 7th, 2008 Interfacing Software Transactional Memory Simplicity vs. Flexibility Vincent Gramoli.
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
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.
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
Unbounded Transactional Memory Paper by Ananian et al. of MIT CSAIL Presented by Daniel.
Department of Computer Science Presenters Dennis Gove Matthew Marzilli The ATOMO ∑ Transactional Programming Language.
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.
Multiprocessor Cache Coherency
KAUSHIK LAKSHMINARAYANAN MICHAEL ROZYCZKO VIVEK SESHADRI Transactional Memory: Hybrid Hardware/Software Approaches.
An Integrated Hardware-Software Approach to Transactional Memory Sean Lie Theory of Parallel Systems Monday December 8 th, 2003.
An Introduction to Software Transactional Memory
Transactional Memory CDA6159. Outline Introduction Paper 1: Architectural Support for Lock-Free Data Structures (Maurice Herlihy, ISCA ‘93) Paper 2: Transactional.
Accelerating Precise Race Detection Using Commercially-Available Hardware Transactional Memory Support Serdar Tasiran Koc University, Istanbul, Turkey.
1 Hardware Transactional Memory (Herlihy, Moss, 1993) Some slides are taken from a presentation by Royi Maimon & Merav Havuv, prepared for a seminar given.
A Qualitative Survey of Modern Software Transactional Memory Systems Virendra J. Marathe Michael L. Scott.
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Low-Overhead Software Transactional Memory with Progress Guarantees and Strong Semantics Minjia Zhang, 1 Jipeng Huang, Man Cao, Michael D. Bond.
Hybrid Transactional Memory Sanjeev Kumar, Michael Chu, Christopher Hughes, Partha Kundu, Anthony Nguyen, Intel Labs University of Michigan Intel Labs.
Cache Coherence Protocols 1 Cache Coherence Protocols in Shared Memory Multiprocessors Mehmet Şenvar.
On the Performance of Window-Based Contention Managers for Transactional Memory Gokarna Sharma and Costas Busch Louisiana State University.
Transactional Memory Lecturer: Danny Hendler. 2 2 From the New York Times…
December 1, 2006©2006 Craig Zilles1 Threads and Cache Coherence in Hardware  Previously, we introduced multi-cores. —Today we’ll look at issues related.
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
Kevin E. Moore, Jayaram Bobba, Michelle J. Moravan, Mark D. Hill & David A. Wood Presented by: Eduardo Cuervo.
Concurrency unlocked Programming
Software Transactional Memory Should Not Be Obstruction-Free Robert Ennals Presented by Abdulai Sei.
Hardware and Software transactional memory and usages in MRE
On Transactional Memory, Spinlocks and Database Transactions Khai Q. Tran Spyros Blanas Jeffrey F. Naughton (University of Wisconsin Madison)
Architectural Features of Transactional Memory Designs for an Operating System Chris Rossbach, Hany Ramadan, Don Porter Advanced Computer Architecture.
18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain? Enable n-tier architectures while not necessarily using.
Advanced Operating Systems (CS 202) Transactional memory Jan, 27, 2016 slide credit: slides adapted from several presentations, including stanford TCC.
Maurice Herlihy and J. Eliot B. Moss,  ISCA '93
Software Coherence Management on Non-Coherent-Cache Multicores
(Nested) Open Memory Transactions in Haskell
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Part 2: Software-Based Approaches
Multiprocessor Cache Coherency
A Qualitative Survey of Modern Software Transactional Memory Systems
Lecture 6: Transactions
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E
Transactional Memory An Overview of Hardware Alternatives
Part 1: Concepts and Hardware- Based Approaches
Hybrid Transactional Memory
Design and Implementation Issues for Atomicity
Lecture 23: Transactional Memory
Advanced Operating Systems (CS 202) Memory Consistency and Transactional Memory Feb. 6, 2019.
Presentation transcript:

Transactional Memory Student Presentation: Stuart Montgomery CS5204 – Operating Systems 1

Transactional Memory Why? Avoid explicit locking Non-blocking: can’t deadlock Higher level abstraction for the programmer “The value of STM is that it allows you to focus on designing applications which happen to scale instead of the mechanisms employed to scale those applications.” CS5204 – Operating Systems 2 Shan Lu, et. al, Learning From Mistakes

Transactional Memory What is TM? Regions of code that manipulate values (memory) atomically ACID: Atomicity, Consistency, Isolation, Durability All or nothing Atomic Regions (Lomet) Hardware TM /1993 (Knight/Herlihy and Moss) Software TM (Shavit and Touitou) CS5204 – Operating Systems 3 apt/projects/TM/LeeRouting/

Transactional Memory HARDWARE TRANSACTIONAL MEMORY CS5204 – Operating Systems 4

Transactional Memory Hardware TM Transactions operate on hardware data cache Changes to memory are committed atomically to other caches A natural extension of Load-Linked/Store-Conditional  LL/SC provides an atomic update to a single word of memory  HTM extends LL/SC to create groups of atomic instructions Generally, HTM systems are bounded  Restricts the size of a transaction! CS5204 – Operating Systems 5

Transactional Memory Hardware TM Concepts Snoopy Cache Coherence – Goodman 1983 Caches listen to the bus to detect changes to their copy of the same cached address CS5204 – Operating Systems 6 Shared Memory Bus addressvaluestatetag cache... CPU

Transactional Memory Hardware TM Instructions LT  Read with NON-exclusive access (normal) LTX  Read with exclusive access  Useful for when we anticipated writing to the read value soon ST  Write to memory Transaction State Instructions: Validate, Commit, Abort XCOMMIT = Old vs. XABORT = New Processor flags TSTATUS and TACTIVE CS5204 – Operating Systems 7

Transactional Memory Quick Example shared int counter; void process(int work){ int success = 0, backoff = BACKOFF_MIN; unsigned wait; while (success < work) { ST(&counter, LTX(&counter) + 1); if (COMMIT()) { success++; backoff = BACKOFF_MIN; } else { wait = random() % (1 << backoff); while (wait--); if (backoff < BACKOFF_MAX) backoff++; } CS5204 – Operating Systems 8 Herlihy and Moss, Transactional Memory: Architectural Support for Lock-Free Data Structures

Transactional Memory Hardware TM Concerns Requires new hardware Possibility of starvation with BUSY signals  Augment with queuing mechanism Separate Transactional Cache or not  1 cache: set size limits transaction size But could use cache emulation in software  Extra abort, etc. logic applies to entire larger cache  Tradeoff between strong atomicity and efficiency Hybrid Systems:  VTM  HASTM  Hybrid TM CS5204 – Operating Systems 9

Transactional Memory Notable HTM Implementations Simulations Sun’s Rock SPARC multicore processor CS5204 – Operating Systems 10 SPARC Rock CPU HTM Test on Rock Surpasses STM

Transactional Memory Performance Simulation results show that transactional memory matches or outperforms the best known locking techniques for simple benchmarks, even in the absence of priority inversion, convoying, and deadlock.  Fewer access to memory Long transactions more likely to abort Large transactions more likely to exceed TM cache size CS5204 – Operating Systems 11

Transactional Memory SOFTWARE TRANSACTIONAL MEMORY CS5204 – Operating Systems 12

Transactional Memory Word-Based STM CS5204 – Operating Systems 13 Shavit & Touitou  Historical  Each word of memory has an ownership record with old values  Transactions can “help” each other Harris & Fraser  Track the deltas in transaction descriptors  Atomically commit transactions to the ownership records

Transactional Memory Object-Based STM CS5204 – Operating Systems 14 Dynamic STM (Herlihy et. al.)  Higher-level TM Objects FSTM (Fraser)  Similar to Dynamic STM Larus and Kozyrakis, Transactional Memory

Transactional Memory Software TM Design Closed nesting  The child commits into the parent Open nesting  The child commits to the world Other considerations:  Direct/Deferred Update  Early/Late Conflict Detection  Conflict Resolution E.g. Abort or Backoff  Nesting  Exceptions Often ignored in STM designs CS5204 – Operating Systems 15 figure adopted from [tcc-mcdonald-isca06]

Transactional Memory Case Study: STM.NET Microsoft’s experiment , then dropped Hook the C# JIT compiler, also investigated C++ Separate Haskell development Joe Duffy’s retrospective on unbounded STM: 1. Applying transactions to intrinsically non-transactional operations (I/O) Reading a block or file from the FS, output to the console, entry in the Event Log, web service calls, etc. 2. Weak vs. Strong Atomicity Weak: Non-TM regions seeing the results of TM regions 3. Privatization 4. “Where is the killer App?”… most applications naturally parallel? CS5204 – Operating Systems 16 “But with the wisdom of age and hindsight, I do believe limited forms of TM could be wildly successful at particular tasks and yet would have avoided many of the biggest challenges with unbounded TM.”

Transactional Memory Other Notable STM Implementations Intel STM Compiler Prototype (C/C++) Sun DSTM2 (Java factories) Several libraries from Harris & Fraser Other languages: Haskell, LISP, Clojure, C#, OCaml, Perl CS5204 – Operating Systems 17

Transactional Memory Summary Hardware TM  Make memory access atomic by holding in a transactional cache  Caches for each CPU cooperate in determining use of memory locations  Faster Software TM  Allows for a larger transactions and more design flexibility than HTM  Both word and object level granularity  Many possible design choices: Strong/Weak Atomicity Granularity Conflict detection Nested (Open or Closed) Real-world implementations continue  Issues with particular design choices of STM.NET CS5204 – Operating Systems 18

Transactional Memory QUESTIONS? CS5204 – Operating Systems 19

Transactional Memory BACKUPS CS5204 – Operating Systems 20

Transactional Memory Weak Atomicity Problem bool itIsOwned = false; MyObj x = new MyObj(); … atomic { // Tx0 atomic { // Tx1 // Claim the state for my use: if (!itIsOwned) itIsOwned = true; x.field += 42; } int z = x.field;... CS5204 – Operating Systems 21