A Relativistic Enhancement to Software Transactional Memory Philip Howard, Jonathan Walpole.

Slides:



Advertisements
Similar presentations
Optimistic Methods for Concurrency Control By : H.T. Kung & John T. Robinson Presenters: Munawer Saeed.
Advertisements

Concurrency Control WXES 2103 Database. Content Concurrency Problems Concurrency Control Concurrency Control Approaches.
Impossibilities for Disjoint-Access Parallel Transactional Memory : Alessia Milani [Guerraoui & Kapalka, SPAA 08] [Attiya, Hillel & Milani, SPAA 09]
1 CSIS 7102 Spring 2004 Lecture 9: Recovery (approaches) Dr. King-Ip Lin.
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Enabling Speculative Parallelization via Merge Semantics in STMs Kaushik Ravichandran Santosh Pande College.
TRANSACTION PROCESSING SYSTEM ROHIT KHOKHER. TRANSACTION RECOVERY TRANSACTION RECOVERY TRANSACTION STATES SERIALIZABILITY CONFLICT SERIALIZABILITY VIEW.
Transactional Locking Nir Shavit Tel Aviv University (Joint work with Dave Dice and Ori Shalev)
CS510 Concurrent Systems Jonathan Walpole. What is RCU, Fundamentally? Paul McKenney and Jonathan Walpole.
Safety Definitions and Inherent Bounds of Transactional Memory Eshcar Hillel.
Inherent limitations on DAP TMs 1 Inherent Limitations on Disjoint-Access Parallel Transactional Memory Hagit Attiya, Eshcar Hillel, Alessia Milani Technion.
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 (TM) Evan Jolley EE 6633 December 7, 2012.
Quick Review of Apr 29 material
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
TOWARDS A SOFTWARE TRANSACTIONAL MEMORY FOR GRAPHICS PROCESSORS Daniel Cederman, Philippas Tsigas and Muhammad Tayyab Chaudhry.
10/31/20111 Relativistic Red-Black Trees Philip Howard 10/31/2011
1 Lecture 23: Transactional Memory Topics: consistency model recap, introduction to transactional memory.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
CS510 Concurrent Systems Class 13 Software Transactional Memory Should Not be Obstruction-Free.
1 Transaction Management Database recovery Concurrency control.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
Scalable Reader Writer Synchronization John M.Mellor-Crummey, Michael L.Scott.
Christopher J. Rossbach, Owen S. Hofmann, Donald E. Porter, Hany E. Ramadan, Aditya Bhandari, and Emmett Witchel - Presentation By Sathish P.
The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.
Unbounded Transactional Memory Paper by Ananian et al. of MIT CSAIL Presented by Daniel.
29-Jun-15 Java Concurrency. Definitions Parallel processes—two or more Threads are running simultaneously, on different cores (processors), in the same.
©Silberschatz, Korth and Sudarshan17.1Database System Concepts 3 rd Edition Chapter 17: Recovery System Failure Classification Storage Structure Recovery.
Transactions and Recovery
Proxy Design Pattern Source: Design Patterns – Elements of Reusable Object- Oriented Software; Gamma, et. al.
Transactions and Reliability. File system components Disk management Naming Reliability  What are the reliability issues in file systems? Security.
Relativistic Red Black Trees. Relativistic Programming Concurrent reading and writing improves performance and scalability – concurrent readers may disagree.
© 2009 Matthew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
08_Transactions_LECTURE2 DBMSs should guarantee ACID properties (Atomicity, Consistency, Isolation, Durability). This is typically done by guaranteeing.
CS510 Concurrent Systems Jonathan Walpole. A Lock-Free Multiprocessor OS Kernel.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Reduced Hardware NOrec: A Safe and Scalable Hybrid Transactional Memory Alexander Matveev Nir Shavit MIT.
HANDLING FAILURES. Warning This is a first draft I welcome your corrections.
CS5204 – Operating Systems Transactional Memory Part 2: Software-Based Approaches.
Concurrency and Transaction Processing. Concurrency models 1. Pessimistic –avoids conflicts by acquiring locks on data that is being read, so no other.
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 File Systems: Consistency Issues. 2 File Systems: Consistency Issues File systems maintains many data structures  Free list/bit vector  Directories.
Chapter 16 Recovery Yonsei University 1 st Semester, 2015 Sanghyun Park.
Internet Software Development Controlling Threads Paul J Krause.
Introduction to Database Systems1. 2 Basic Definitions Mini-world Some part of the real world about which data is stored in a database. Data Known facts.
Kernel Locking Techniques by Robert Love presented by Scott Price.
DOUBLE INSTANCE LOCKING A concurrency pattern with Lock-Free read operations Pedro Ramalhete Andreia Correia November 2013.
Chapter 10 Recovery System. ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are.
Giovanni Chierico | May 2012 | Дубна Data Concurrency, Consistency and Integrity.
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.
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.
Read-Copy-Update Synchronization in the Linux Kernel 1 David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis.
Concurrent Revisions: A deterministic concurrency model. Daan Leijen & Sebastian Burckhardt Microsoft Research (OOPSLA 2010, ESOP 2011)
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
Transaction Management
Background on the need for Synchronization
Minh, Trautmann, Chung, McDonald, Bronson, Casper, Kozyrakis, Olukotun
Part 2: Software-Based Approaches
Concurrency Control WXES 2103 Database.
Lecture 22: Consistency Models, TM
Dr. Mustafa Cem Kasapbaşı
Recovery System.
Hybrid Transactional Memory
Atomic Commit and Concurrency Control
Software Transactional Memory Should Not be Obstruction-Free
Presentation transcript:

A Relativistic Enhancement to Software Transactional Memory Philip Howard, Jonathan Walpole

Two Methodolgies Relativistic Programming: Optimize Read Side Concurrency Serialize Writes with traditional locking (of entire instance of type, e.g. entire tree) Issue: Update performance degrades as write/read ratio increases Transactional Memory: Concurrent Writes (and Reads) Takes advantage of disjoint access concurrency Works for all read/write ratios, but does not take advantage of high read/write ratios

Two Methodolgies, Take Two Relativistic Programming: R/W Joint access Concurrency Silent on W/W concurrency Multiple Readers/ One Writer scales even in presence of high contention (e.g. small RB tree) Transactional Memory: R/W Disjoint access concurrency W/W Disjoint access concurrency R/W performance may degrade as contention increases (e.g. data set becomes small)

Can We glue them together?

Outline 1.SwissTM 2.Relativistic Programming 3.Relativistic Transactional Memory 4.Modifications to SwissTM 5.Correctness Argument 6.Performance 7.Future Work: Privatization? 8.What is the Performance Cost? 9.What functionality do we give up? 10.References

SwissTM SwissTM very similar to STM of Ennals Paper Word Based Lock-based (from Ennals and Fraser) Not Obstruction Free 2 Phase Locking with Contention Management Invisible Reads: Read Transactions Cannot Block Writes Opaque: See All or nothing: "safe from crashes/loops" Weakly Atomic: Allows accesses outside TM Purpose of SwissTM is to stretch STMs to a mixed workload including larger transactions, on complex, non-uniform data structures with irregular access patterns. "Strectching Transactional Memory" Aleksandar Dragojevíc, Rachid Guerraoui, Michal Kapalka, 2009

SwissTM Global transaction counter, commit-ts (contention issue?) Every write transaction gets a transaction number at commit: myts = increment&set(commit-ts); Version number of a word is the transaction counter (myts) of the transaction that last wrote to the word. Every transaction, records global transaction count at start-transaction: ts.valid-ts = commit-ts; Read Transaction Commit is a noop (Already known to be consistent) Each read_word() checks that the version is the same as its ts.valid-ts (Sandwich the read of the word’s value between 2 reads of the word’s version/lock) There are read-locks -- but only gotten at commit time by write transactions Read transactions don't get read locks!

SwissTM Example: Readonly Tx t.start(); t.read_word(&checking); <- commit of writer happens here t.read_word(&savings); if (checking + savings < 1000) { // balance has dropped below $1000 } t.commit(); Meanwhile a writer: t.start(); t.read_word(&checking); t.write_word(&checking, checking+m); t.read_word(&savings); t.write_word(&savings, savings-m); t.commit();

Relativistic Programming Review Writers must keep data in an always consistent state: E.g. To update, copy old version to private memory, update it, atomically publish new version (with memory barriers to assure that the updates to the private copy happen before the publish). Readers must use demarcated read-sections. Outside the read section, readers cannot hold a reference to the shared object. Read sections are used by writers to define a grace period: wfr() blocks a writer (at least) until all read sections that were active when the write transaction started have ended.

Moving a node requires wfr()

Relativistic Transactional Memory 1.Weakly Atomic (as opposed to strongly atomic) 2.Writes that get rolled back are never visible to readers 3.Writes become visible in program order 4.Allow delays to drain concurrent readers out of their read- sections Which of these requirements requires modifications to SwissTM? Which of these requirements would not be met by optimistic update in place STMs?

RP reads vs. SwissTM reads 1.RP reads are semi-visible, but (like SwissTM) they don't lock anything. 2.RP reads cannot fail. 3.RP reads are truely concurrent with writers (during writer's commit), so must be done "relativistically", honoring all of the relativistic writers instructions. What if our STM optimistically did updates in place and then rolled back any transaction that conflicted at its commit time?

Modifications to SwissTM 1. A separate "RP" re-do log stored in program order. Commit code executes from this new log, rather than the original SwissTM log. All writes are recorded: I.e. when there is a rewrite, both the original write and the rewrite will be done, in their original program order positions. 2. Added new primitives that will be logged into new "RP" log: 1.wait_for_readers: Grace period to allow existing readers to complete their read-sections 2.rp-produce (flag to a write) Add a memory barrier before a write. Only needed on certain writes: i.e. when it was used in the original RP implementation. 3.rp-free: Register a call back to free memory

Correctness of RP RP is OK if updates are commutable -- if the order of operations does effect the integrity of the ADT. (We will discuss this later...)

How does STM effect RP? SwissRP is a modified RB tree implementation that is RP safe SwissRP has all the RP tricks: always keeping the data structure "safe" for concurrent readers, memory barriers, grace periods for correctness and memory freeing safety. So only difference that readers "see" between a RP and SwissRP is that all of the writes are delayed until commit time.

Integrity of the STM 1. Moving a transactional read to a relativistic read has no impact on transactional writes, because the Transactional reads were already invisible to transactional writes. 2. All the original SwissTM meta-data is maintained -- integrity of conflict detection, contention management, etc. is maintained. 3. Changes to the "actual writes to memory" during commit should have no impact (by definition of a transaction) -- except to allow relativistic reads. 4. wait_for_readers() only waits for Relativistic Readers -- not for a different Write Transaction t'. Therefore no deadlock.

Performance: SwissTM vs. RP What was the original Problem? Does RP-STM solve it?

Update Performance

Read Performance

Future Enhancements; Privatization How might we make Updates even faster? How would we do this? Is it worth it? Privatization: Atomically take an object or part of an object private (to an individual thread, say) work on it for a while and then atomically make it public again.

What is the Performance Tradeoff of RP-STM?

Functionality What functionality do we give up by moving from Transactional Reads to Relativistic Reads? What is a value of transactions that we might have forgotten to mention on Monday?

Bank of America Consider a write transaction that transfers money from one account to another. Consider a read transaction that reports the total balance for all my accounts: read savings; read checking BofA: If your total balance drops below $1000 at any time during the month, you will be charged $5 for debit card purchases during that month. Can we add a wfr() to the transfer transaction to fix it? Do all write transactions have to anticipate and code for an "arbitrary" relative reader? So we have concept of RP-safe code similar to thread-safe code? Do kernel's have these sorts of read transactions? Can RP reads and transactional reads coexist?

Conclusions RP and SwissTM are compatible. RP and SwissTM complement each other well for read and update performance. Not all STM are compatible with RP Demonstrates that RP has different Write Synchronization Alternatives.

References Strectching Transactional Memory Aleksandar Dragojevíc, Rachid Guerraoui, Michal Kapalka PLDI 2009 Also ppt slides by Gar Nissan Relativistic Read-Black Trees Philip Howard Jonathan Walpole, 2011 Concurrency and Computation: Practice and Experience (in submission), July 2011.

fin

Read Scalability

Write Scalability

Varying Update Rate