Conflict Detection and Validation Strategies for Software Transactional Memory

Similar documents
Lowering the Overhead of Nonblocking Software Transactional Memory

Relaxing Concurrency Control in Transactional Memory. Utku Aydonat

6.852: Distributed Algorithms Fall, Class 20

Agenda. Designing Transactional Memory Systems. Why not obstruction-free? Why lock-based?

Lecture 10: Avoiding Locks

Locking: A necessary evil? Lecture 10: Avoiding Locks. Priority Inversion. Deadlock

A Dynamic Instrumentation Approach to Software Transactional Memory. Marek Olszewski

Lowering the Overhead of Nonblocking Software Transactional Memory

Lecture 21: Transactional Memory. Topics: Hardware TM basics, different implementations

Design Tradeoffs in Modern Software Transactional Memory Systems

Lecture 21: Transactional Memory. Topics: consistency model recap, introduction to transactional memory

Transactional Memory. How to do multiple things at once. Benjamin Engel Transactional Memory 1 / 28

An Update on Haskell H/STM 1

Lock vs. Lock-free Memory Project proposal

Lecture: Transactional Memory. Topics: TM implementations

Commit Phase in Timestamp-based STM

Lecture 20: Transactional Memory. Parallel Computer Architecture and Programming CMU , Spring 2013

Transactional Memory: Architectural Support for Lock-Free Data Structures Maurice Herlihy and J. Eliot B. Moss ISCA 93

A Qualitative Survey of Modern Software Transactional Memory Systems

Lecture: Consistency Models, TM. Topics: consistency models, TM intro (Section 5.6)

McRT-STM: A High Performance Software Transactional Memory System for a Multi- Core Runtime

Privatization Techniques for Software Transactional Memory

Transactional Memory

On Improving Transactional Memory: Optimistic Transactional Boosting, Remote Execution, and Hybrid Transactions

Cost of Concurrency in Hybrid Transactional Memory. Trevor Brown (University of Toronto) Srivatsan Ravi (Purdue University)

Introduction to Data Management CSE 344

CPSC/ECE 3220 Summer 2017 Exam 2

Transaction Safe Nonblocking Data Structures

Concurrent Preliminaries

Transactional Memory

Summary: Issues / Open Questions:

Lecture: Consistency Models, TM

FlexTM. Flexible Decoupled Transactional Memory Support. Arrvindh Shriraman Sandhya Dwarkadas Michael L. Scott Department of Computer Science

Chí Cao Minh 28 May 2008

Serializability of Transactions in Software Transactional Memory

Improving the Practicality of Transactional Memory

Evaluating Contention Management Using Discrete Event Simulation

Improving STM Performance with Transactional Structs 1

Mutex Locking versus Hardware Transactional Memory: An Experimental Evaluation

Lecture 12: TM, Consistency Models. Topics: TM pathologies, sequential consistency, hw and hw/sw optimizations

Lecture 7: Transactional Memory Intro. Topics: introduction to transactional memory, lazy implementation

Atomic Transac1ons. Atomic Transactions. Q1: What if network fails before deposit? Q2: What if sequence is interrupted by another sequence?

) Intel)(TX)memory):) Transac'onal) Synchroniza'on) Extensions)(TSX))) Transac'ons)

Distributed Systems. 12. Concurrency Control. Paul Krzyzanowski. Rutgers University. Fall 2017

Linked Lists: The Role of Locking. Erez Petrank Technion

Concurrency control CS 417. Distributed Systems CS 417

Dealing with Issues for Interprocess Communication

ABORTING CONFLICTING TRANSACTIONS IN AN STM

Permissiveness in Transactional Memories

Potential violations of Serializability: Example 1

Summary: Open Questions:

Coping With Context Switches in Lock-Based Software Transacional Memory Algorithms

6 Transactional Memory. Robert Mullins

Transactional Memory. Yaohua Li and Siming Chen. Yaohua Li and Siming Chen Transactional Memory 1 / 41

6.033: Fault Tolerance: Isolation Lecture 17 Katrina LaCurts,

Identity, State and Values

Transactional Memory. Lecture 19: Parallel Computer Architecture and Programming CMU /15-618, Spring 2015

RCU in the Linux Kernel: One Decade Later

Software transactional memory

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

The Common Case Transactional Behavior of Multithreaded Programs

! Part I: Introduction. ! Part II: Obstruction-free STMs. ! DSTM: an obstruction-free STM design. ! FSTM: a lock-free STM design

New Programming Abstractions for Concurrency in GCC 4.7. Torvald Riegel Red Hat 12/04/05

Performance Improvement via Always-Abort HTM

Lecture: Transactional Memory, Networks. Topics: TM implementations, on-chip networks

Integrating Transactionally Boosted Data Structures with STM Frameworks: A Case Study on Set

Lock Tuning. Concurrency Control Goals. Trade-off between correctness and performance. Correctness goals. Performance goals.

False Conflict Reduction in the Swiss Transactional Memory (SwissTM) System

Cache Coherence in Distributed and Replicated Transactional Memory Systems. Technical Report RT/4/2009

Lecture 6: TM Eager Implementations. Topics: Eager conflict detection (LogTM), TM pathologies

Transactifying Apache s Cache Module

Reminder from last time

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 14 November 2014

Speculative Lock Elision: Enabling Highly Concurrent Multithreaded Execution

Outline. Database Tuning. Ideal Transaction. Concurrency Tuning Goals. Concurrency Tuning. Nikolaus Augsten. Lock Tuning. Unit 8 WS 2013/2014

Ignite Key-Value Transactions Architecture

Remote Transaction Commit: Centralizing Software Transactional Memory Commits

Advanced Contention Management for Dynamic Software Transactional Memory

Synchronization. Clock Synchronization

A transaction is a sequence of one or more processing steps. It refers to database objects such as tables, views, joins and so forth.

Lecture 8: Eager Transactional Memory. Topics: implementation details of eager TM, various TM pathologies

CSE 344 MARCH 9 TH TRANSACTIONS

LogTM: Log-Based Transactional Memory

Advanced Topic: Efficient Synchronization

Persistent Data Structures and Managed References

3. Concurrency Control for Transactions Part One

Database Management and Tuning

G Programming Languages Spring 2010 Lecture 13. Robert Grimm, New York University

Remote Invalidation: Optimizing the Critical Path of Memory Transactions

NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 28 November 2014

Exam 2 Review. October 29, Paul Krzyzanowski 1

The Semantics of Progress in Lock-Based Transactional Memory

Concurrent & Distributed Systems Supervision Exercises

Distributed Systems. Lec 9: Distributed File Systems NFS, AFS. Slide acks: Dave Andersen

L i (A) = transaction T i acquires lock for element A. U i (A) = transaction T i releases lock for element A

Implementing and Evaluating Nested Parallel Transactions in STM. Woongki Baek, Nathan Bronson, Christos Kozyrakis, Kunle Olukotun Stanford University

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

Synchronization. CSCI 5103 Operating Systems. Semaphore Usage. Bounded-Buffer Problem With Semaphores. Monitors Other Approaches

Transactional Memory. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit

arxiv: v1 [cs.dc] 13 Aug 2013

Transcription:

Conflict Detection and Validation Strategies for Software Transactional Memory Michael F. Spear, Virendra J. Marathe, William N. Scherer III, and Michael L. Scott University of Rochester www.cs.rochester.edu/research/synchronization/ DISC 2006 MLS 1

Software Transactional Memory! Atomicity rather than mutual exclusion; avoids deadlock, priority inversion, and wrong lock bugs» aims for the clarity of coarse grain locks with the performance of fine(r)-grain locks! Nonblocking STM additionally tolerates preemption, page faults, and thread failure» these may be more important on general purpose systems than they have been at the high end more multiprogramming less predictable job mix " Focus on NB TM how fast can we make it go?» some results applicable to blocking TM as well MLS 2

RSTM Overview! Nonblocking (obstruction free) TM library for C++! Per-object metadata, explicit atomic operations! Roll back only Shared (transactional) objects on failure! Open operation (as opposed to per-access bookkeeping)! Described at TRANSACT 06! Optimized for low heap churn and limited indirection MLS 3

Object-based NB STM Object Data pointer Valid Version Owner Version Owner Status ACTIVE! Only owner can change the object! Only one transaction can own the object at a time! Until the owner commits, everyone sees Valid Version MLS 4

Atomic Commit! Single CAS updates all objects to the new version COMMITTED ACTIVE CAS MLS 5

Conflict Detection! Identifies threats to serializability» If A and B use X concurrently and at least one writes, they cannot both commit» Choosing between them is the subject of other papers! Writers become visible by acquiring an object» can do so eagerly (at open time) or lazily (at commit)» eager avoids useless work; lazy avoids spurious aborts! Readers may or may not be visible» if visible, they suffer misses for metadata update» otherwise, only readers can detect RW conflicts! Mixed invalidation delays action on RW conflicts» both threads may commit if reader does so first MLS 6

Validation! Assures isolation of doomed transactions! Newly opened objects must be consistent with previous reads! Tolerate errors in doomed transactions?! Rely on a typesafe language?! No! These do not protect us. MLS 7

Validation matters!! Suppose class A has subclasses B and C! B.foo() is tx-safe; C.foo() is not Transaction 1 Transaction 2 Read X Acquire Y Acquire X Make Y a B Update X COMMIT Read Y Validation could detect inconsistency here Object X Object Y is a B C Object Y this.foo() is is not safe safe Call Y.foo() Error! " Periodic checks are not enough» must validate prior to every dangerous op MLS 8

What to do?! Complete sandboxing (high constant OH)! Visible readers (heavy cache penalty)! Incremental validation (O(n 2 ) total cost)! HW assist (not in this talk :-)! Dump it on the programmer! Incremental + heuristics» Lev & Moir: per-object reader count, global conflict count; skip validation if the latter does not change! 2N extra atomic ops for an N-object reader, most of which will miss in the cache MLS 9

The Global Commit Counter! Shared count of transactions that have tried to commit! Check on every new open, and prior to commit! If value has changed, do incremental validation; otherwise transaction is still safe» approximates mixed invalidation» (we also built true mixed; see paper for details)! If value never seems to change, can optimistically elide bookkeeping and contention management» single-thread optimization» (must still update and check the global counter) MLS 10

Hash Table 80/10/10 50% load ouch 16p SunFire! Very few objects read; invisible readers work great! Very little contention; global commit counter doesn t help MLS 11

Red- Black Tree 80/10/10 64K range! Modest contention; visible reads are too expensive! ~16 objects read > sig. validation OH; CCtr, Mixed work well MLS 12

LFU Cache index + PQ; Zipf! Extreme case: short transactions, high contention > Invis/Lazy! Validation not significant > CCtr doesn t help much MLS 13

Random Graph ~128 nodes; degree avg. ~4! Torture test: long transactions, high contention! CCtr, Mixed a huge win, but coarse grain lock much better MLS 14

Conclusions! Conflict detection and validation matter» dramatic effect on performance! No overall winning policy one size does not fit all» adaptation a promising direction for future work! Visible readers are rarely worthwhile» too many cache misses! Global commit counter a valuable heuristic» can dramatically reduce the cost of validation» approximates mixed invalidation» 20% 5X gain when running single-threaded» may hurt a little in low-contention SMP workloads MLS 15

Status and Plans! RSTM 2 available for download» www.cs.rochester.edu/research/synchronization/rstm/» for gcc C++ on SPARC v8-plus and x86» Java version planned for later this year (collaboration w/sun)! Formalization of STM semantics! RTM HW/SW hybrid! Planning compiler support TRANSACT 06! Numerous semantic/notational issues (ask me later!)! Benchmarks and applications! Interoperation with lock-based and nonblocking code MLS 16

www.cs.rochester.edu/research/synchronization/