Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories.

Slides:



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

Chapter 3 Memory Management
Chapter 13 Control Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Control Structures Conditional.
Privatization Techniques for Software Transactional Memory Michael F. Spear, Virendra J. Marathe, Luke Dalessandro, and Michael L. Scott University of.
Enabling Speculative Parallelization via Merge Semantics in STMs Kaushik Ravichandran Santosh Pande College.
Chapter 15: Transactions Transaction Concept Transaction Concept Concurrent Executions Concurrent Executions Serializability Serializability Testing for.
Software Transactional Memory and Conditional Critical Regions Word-Based Systems.
Monitoring Data Structures Using Hardware Transactional Memory Shakeel Butt 1, Vinod Ganapathy 1, Arati Baliga 2 and Mihai Christodorescu 3 1 Rutgers University,
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Rich Transactions on Reasonable Hardware J. Eliot B. Moss Univ. of Massachusetts,
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)
Transaction.
Chapter 6 Limited Direct Execution
Thread-Level Transactional Memory Decoupling Interface and Implementation UW Computer Architecture Affiliates Conference Kevin Moore October 21, 2004.
Manchester University Transactions for Scala Daniel Goodman Euro TM Paris, May 2011.
Transactional Memory (TM) Evan Jolley EE 6633 December 7, 2012.
HW Support for STM Breakout Session Summary Christos Kozyrakis Pervasive Parallelism Laboratory Stanford University
Making Debuggers Transaction-Ready Yossi Lev Brown University & Sun Microsystems Laboratories.
Nested Transactional Memory: Model and Preliminary Architecture Sketches J. Eliot B. Moss Antony L. Hosking.
1 MetaTM/TxLinux: Transactional Memory For An Operating System Hany E. Ramadan, Christopher J. Rossbach, Donald E. Porter and Owen S. Hofmann Presenter:
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
Misc. Announcements Assignment available end of the day today –Due back in 11/03 (after break) Will also update slides on website –Today Midterm next week.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
Exceptions and side-effects in atomic blocks Tim Harris.
Transaction Processing IS698 Min Song. 2 What is a Transaction?  When an event in the real world changes the state of the enterprise, a transaction is.
Early OS security Overview by: Greg Morrisett Cornell University, Edited (by permission) for CSUS CSc250 by Bill Mitchell.
Transaction Management WXES 2103 Database. Content What is transaction Transaction properties Transaction management with SQL Transaction log DBMS Transaction.
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.
Fast Dynamic Binary Translation for the Kernel Piyus Kedia and Sorav Bansal IIT Delhi.
An Integrated Hardware-Software Approach to Transactional Memory Sean Lie Theory of Parallel Systems Monday December 8 th, 2003.
Chapter 10 And, Finally... The Stack. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display Stacks A LIFO.
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
Copyright 2007 Sun Microsystems, Inc SNZI: Scalable Non-Zero Indicator Yossi Lev (Brown University & Sun Microsystems Laboratories) Joint work with: Faith.
Chapter 19 Recovery and Fault Tolerance Copyright © 2008.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Databases Illuminated
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Demand Paging.
StealthTest: Low Overhead Online Software Testing Using Transactional Memory Jayaram Bobba, Weiwei Xiong*, Luke Yen †, Mark D. Hill, and David A. Wood.
Consistency Oblivious Programming Hillel Avni Tel Aviv University.
CSE 332: C++ Statements C++ Statements In C++ statements are basic units of execution –Each ends with ; (can use expressions to compute values) –Statements.
Lecture 26 Virtual Machine Monitors. Virtual Machines Goal: run an guest OS over an host OS Who has done this? Why might it be useful? Examples: Vmware,
Software System Lab. Transactions Transaction Concept A transaction is a unit of program execution that accesses and possibly updates various.
18 September 2008CIS 340 # 1 Last Covered (almost)(almost) Variety of middleware mechanisms Gain? Enable n-tier architectures while not necessarily using.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
R 1 Transactional abstractions: beyond atomic update Tim Harris r.

Translation Lookaside Buffer
Maurice Herlihy and J. Eliot B. Moss,  ISCA '93
Free Transactions with Rio Vista
Software Perspectives on Transactional Memory
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Part 2: Software-Based Approaches
PHyTM: Persistent Hybrid Transactional Memory
Mechanism: Limited Direct Execution
Faster Data Structures in Transactional Memory using Three Paths
SABRes: Atomic Object Reads for In-Memory Rack-Scale Computing
Introduction to Operating Systems
Two Ideas of This Paper Using Permissions-only Cache to deduce the rate at which less-efficient overflow handling mechanisms are invoked. When the overflow.
Chapter 9: Virtual-Memory Management
Chapter 10 Transaction Management and Concurrency Control
Free Transactions with Rio Vista
Hybrid Transactional Memory
Operating Systems: A Modern Perspective, Chapter 6
Error Handling.
Lecture 23: Transactional Memory
Server-Side Programming
Presentation transcript:

Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories Joint work with: Jan-Willem Maessen Sun Microsystems Laboratories

Hardware Transactional Memory (HTM) Fast, often supports Strong Atomicity Restrictions –Resource limitations: bounded size –Expressiveness limitations No true closed/open nesting No nesting constructs: or-else, retry, etc. No debugging support No long transactions (context switch, timer interrupts)

This Work True closed nesting of transactions Pause a transaction & Inspect its read/write sets Debugging, Open Nesting Better survive long transactions Improve expressiveness of best effort HTM using simple software support

How? Segmentation Introduce Split Hardware Transaction (SpHT) –A split transaction consists of multiple segments –Each segment executed by its own hardware transaction –using minimal software support combine all to one atomic operation Our goal is to overcome expressiveness limitations Not to overcome resource limitations Get strong atomicity If supported by HTM

The SpHT Algorithm Each segment is executed by a hw transaction. Defer Writes: log in a write-set Isolation: split transactions partial state not exposed when committing segments hw transaction Log Reads, and validate them at segments beginning Consistency: address read by any segment changes current hw transaction fails. Copy back by last hw transaction: write-set shared memory Atomicity: last hw transaction runs all reads & writes of split transaction. Hardware: conflict detection. Guarantees atomicity. Software: read/write tracking. Enhances flexibility.

SpHT for Closed Nesting SpHT_Begin begins a (nested) transaction, starting its first segment SpHT_Commit ends a (nested) transaction, ending its last segment SpHT_Pause pauses a transaction, ending its current segment SpHT_Resume resumes a transaction, starting a new segment SpHT_Read / SpHT_Write read/write ops, checking & updating the read/write sets

Segmentation for Closed Nesting –End a segment before a nested transaction, Begins a new one after it. atomic { a++ atomic { foo() } b++ }

Segmentation for Closed Nesting –End a segment before a nested transaction, Begins a new one after it. SpHT begin() SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() SpHT_begin() foo() SpHT_commit() SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) SpHT_commit() atomic { a++ atomic { foo() } b++ }

Two ways a segments execution may fail –HW transaction aborts: SpHT begin() SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() SpHT_begin() foo() SpHT_commit() SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) SpHT_commit() atomic { a++ atomic { foo() } b++ }

SpHT begin() SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() SpHT_begin() foo() SpHT_commit() SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) SpHT_commit() atomic { a++ atomic { foo() } b++ } Two ways a segments execution may fail –HW transaction aborts: control returns to beginning of segment

SpHT begin() SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() SpHT_begin() foo() SpHT_commit() SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) SpHT_commit() atomic { a++ atomic { foo() } b++ } Two ways a segments execution may fail –HW transaction aborts: control returns to beginning of segment –Validation failure: retry the enclosing transaction

Two ways a segments execution may fail –HW transaction aborts: control returns to beginning of segment –Validation failure: retry the enclosing transaction use exceptions for non-local control transfer while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ }

SpHT Operations Implementation: while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ }

SpHT Operations Implementation: –HW Interface: HTBegin, HTCommit HTBegin returns true when transaction begins, false when it fails while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ }

SpHT Operations Implementation: –HW Interface: HTBegin, HTCommit HTBegin returns true when transaction begins, false when it fails while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid if (outermost) copy-back() HTCommit() while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ } HTCommit()

What about the state of the Read/Write Sets ? while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid if (outermost) copy-back() HTCommit() while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ } HTCommit()

Stack of Read/Write Set states –Manipulated by SpHT_Push, SpHT_Pop, and SpHT_Restore Maintain the stack invariant: Top-stack state is the beginning state of innermost transaction. while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid if (outermost) copy-back() HTCommit() while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ } HTCommit()

Stack of Read/Write Set states –Manipulated by SpHT_Push, SpHT_Pop, and SpHT_Restore Maintain the stack invariant: Top-stack state is the beginning state of innermost transaction. while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid SpHT_pop() while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() throw SpHT_invalid if (outermost) copy-back() HTCommit() while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } atomic { a++ atomic { foo() } b++ } HTCommit() SpHT_push()

while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() SpHT_pop() SpHT_restore() throw SpHT_invalid SpHT_pop() while (!HTBegin()) { ; } if (!SpHT validate()) HTCommit() SpHT_restore() throw SpHT_invalid if (outermost) copy-back() HTCommit() while (true) { SpHT begin() try { SpHT_write(&a,1+SpHT_read(&a)) SpHT_pause() while (true) { SpHT_begin() try { foo() } catch SpHT_invalid { continue } SpHT_commit() break } SpHT_resume() SpHT_write(&b,1+SpHT_read(&b)) } catch SpHT_invalid { continue } SpHT_commit() break } Stack of Read/Write Set states –Manipulated by SpHT_Push, SpHT_Pop, and SpHT_Restore Maintain the stack invariant: Top-stack state is the beginning state of innermost transaction. atomic { a++ atomic { foo() } b++ } HTCommit() SpHT_push()

Additional Notes Support nesting constructs orElse, user level abort, retry, etc. Integrate with HyTM or PhTM –Run concurrently as is with HW transactions –Also with SW transactions with same overhead like HyTM

Optimizations Exploit HTM features –Non-transactional access during a HW transaction –Use reported conflict address to avoid validation Avoid validation on every segment Roll back multiple levels

One important question: Are we faster than STM?

Evaluation SpHT Prototype in C++ –Local read/write sets: Arrays, fast lookup for write set –No stack mechanism at this point Can retry current segment Is not likely to change the answer Simulated HTM support: variant of LogTM Compared TL2, SpHT, and pure HTM. Benchmark: RBTree, 10% Ins, 10% Del, 80% lookup How much benefit do we get by handling conflicts in hardware?

Results

Experiments with Nesting In the paper: –Used hand-coded contrived example –Compared No Nesting Closed Nesting Open Nesting Try-Atomic

Summary Split Hardware Transactions –Hardware: handle conflicts –Software: read/write tracking –Segmentation: One atomic operation, multiple HW Transactions More flexibility with best-effort HTM –Closed and Open Nesting –Debugging Support –Long Transactions