Transactional Memory. Concurrency unlocked Programming. Bingsheng Wang TM Operating Systems

Similar documents
An Introduction to Transactional Memory

Lecture 12 Transactional Memory

Fall 2012 Parallel Computer Architecture Lecture 16: Speculation II. Prof. Onur Mutlu Carnegie Mellon University 10/12/2012

Chí Cao Minh 28 May 2008

Hardware Transactional Memory Architecture and Emulation

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

Performance Comparison of Various STM Concurrency Control Protocols Using Synchrobench

The Multicore Transformation

6 Transactional Memory. Robert Mullins

Lock vs. Lock-free Memory Project proposal

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

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

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

THE concept of a transaction forms the foundation of

Transactional Memory. Prof. Hsien-Hsin S. Lee School of Electrical and Computer Engineering Georgia Tech

Scheduling Transactions in Replicated Distributed Transactional Memory

EazyHTM: Eager-Lazy Hardware Transactional Memory

Potential violations of Serializability: Example 1

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

HTM in the wild. Konrad Lai June 2015

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

Using Software Transactional Memory In Interrupt-Driven Systems

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

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

Lecture X: Transactions

Design Tradeoffs in Modern Software Transactional Memory Systems

Transactional Memory

Lecture 6: Lazy Transactional Memory. Topics: TM semantics and implementation details of lazy TM

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

COMP3151/9151 Foundations of Concurrency Lecture 8

specstm: Software Transactional Memory with Thread-Level Speculation Support

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

Consistency in Distributed Systems

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

LogTM: Log-Based Transactional Memory

Hardware Transactional Memory. Daniel Schwartz-Narbonne

bool Account::withdraw(int val) { atomic { if(balance > val) { balance = balance val; return true; } else return false; } }

CSE 544 Principles of Database Management Systems. Alvin Cheung Fall 2015 Lecture 14 Distributed Transactions

Synchronization Part 2. REK s adaptation of Claypool s adaptation oftanenbaum s Distributed Systems Chapter 5 and Silberschatz Chapter 17

DHTM: Durable Hardware Transactional Memory

Yuxi Chen, Shu Wang, Shan Lu, and Karthikeyan Sankaralingam *

Log-Based Transactional Memory

High Performance Datacenter Networks

TRANSACTIONAL EXECUTION: TOWARD RELIABLE, HIGH- PERFORMANCE MULTITHREADING

Lock Elision and Transactional Memory Predictor in Hardware. William Galliher, Liang Zhang, Kai Zhao. University of Wisconsin Madison

Speculative Synchronization

Commit Algorithms for Scalable Hardware Transactional Memory. Abstract

INTRODUCTION. Hybrid Transactional Memory. Transactional Memory. Problems with Transactional Memory Problems

Lecture: Consistency Models, TM

Portland State University ECE 588/688. Transactional Memory

Fall 2012 Parallel Computer Architecture Lecture 15: Speculation I. Prof. Onur Mutlu Carnegie Mellon University 10/10/2012

Snapshots and Software Transactional Memory

Snapshots and Software Transactional Memory

TRANSACTION MEMORY. Presented by Hussain Sattuwala Ramya Somuri

Transaction Memory for Existing Programs Michael M. Swift Haris Volos, Andres Tack, Shan Lu, Adam Welc * University of Wisconsin-Madison, *Intel

Deconstructing Transactional Semantics: The Subtleties of Atomicity

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

Concurrent & Distributed Systems Supervision Exercises

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

Development of Technique for Healing Data Races based on Software Transactional Memory

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

Snapshots and software transactional memory

CSE 444: Database Internals. Lectures 13 Transaction Schedules

A Correctness Criterion for Eager Approach Validation for Transactional Memory System

Lecture: Transactional Memory. Topics: TM implementations

A Survey Paper on Transactional Memory

Recoverability. Kathleen Durant PhD CS3200

Hybrid Transactional Memory

PERFORMANCE PATHOLOGIES IN HARDWARE TRANSACTIONAL MEMORY

Software transactional memory

A Qualitative Survey of Modern Software Transactional Memory Systems

6.852: Distributed Algorithms Fall, Class 20

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

DESIGNING AN EFFECTIVE HYBRID TRANSACTIONAL MEMORY SYSTEM

Implementing caches. Example. Client. N. America. Client System + Caches. Asia. Client. Africa. Client. Client. Client. Client. Client.

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

Improving the Practicality of Transactional Memory

Lecture 4: Directory Protocols and TM. Topics: corner cases in directory protocols, lazy TM

Enhancing Concurrency in Distributed Transactional Memory through Commutativity

LOCK-FREE DINING PHILOSOPHER

Do you have to reproduce the bug on the first replay attempt?

Concurrent Preliminaries

Cigarette-Smokers Problem with STM

Data Speculation Support for a Chip Multiprocessor Lance Hammond, Mark Willey, and Kunle Olukotun

Transactional Memory

XI. Transactions CS Computer App in Business: Databases. Lecture Topics

Composable Shared Memory Transactions Lecture 20-2

Transactional Memory. review articles. Is TM the answer for improving parallel programming?

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

Transaction Management. Pearson Education Limited 1995, 2005

GLocks: Efficient Support for Highly- Contended Locks in Many-Core CMPs

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

CS377P Programming for Performance Multicore Performance Synchronization

High Performance Transactions in Deuteronomy

Lecture 8: Transactional Memory TCC. Topics: lazy implementation (TCC)

The transaction. Defining properties of transactions. Failures in complex systems propagate. Concurrency Control, Locking, and Recovery

Mohamed M. Saad & Binoy Ravindran

Database Systems. Announcement

Architectural Semantics for Practical Transactional Memory

Synchronization Part II. CS403/534 Distributed Systems Erkay Savas Sabanci University

Transcription:

Concurrency unlocked Programming Bingsheng Wang TM Operating Systems 1

Outline Background Motivation Database Transaction Transactional Memory History Transactional Memory Example Mechanisms Software Transactional Memory Hardware Transactional Memory Application Bingsheng Wang TM Operating Systems 2

Background Around 2004, 50 years of exponential improvement in the performance of sequential computers end, due to power and cooling concerns In the terminology of Intel s founder, Andrew Grove, this is an inflection point a time in the life of a business when its fundamentals are about to change Multiprocessor Bingsheng Wang TM Operating Systems 3

Motivation Difficulty of Multiprocessor Programming: Parallelism and Nondeterminacy Prune nondeterminism Violation(atomicity-violation, order-violation) Deadlock Parallelism programming (Multi-thread programming) lacks comparable abstraction mechanisms. Bingsheng Wang TM Operating Systems 4

Database Transaction A transaction specifies a program semantics in which a computation executes as if it was the only computation accessing the database. Other computations may execute simultaneously, but the model restricts the allowable interactions among the transactions. Offer an abstraction mechanism in database systems for reusable parallel computations. ACID (Atomic, Consistent, Isolated and Durable) Bingsheng Wang TM Operating Systems 5

History In 1977, Lomet proposed the idea to map database transaction into programming language, but no implementation Transactional Memory In 1993, Herlihy and Moss proposed hardware supported transactional memory In 1993, Stone et al. proposed an atomic multiword operation known as Oklahoma Update In recent years, a huge ground swell of interest in both hardware and software systems for implementing transactional memory. Bingsheng Wang TM Operating Systems 6

Transactional Memory Steal ideas from database transaction. (A transaction is a sequence of actions that appears indivisible and instantaneous to an outside observer.) The properties of transactions provide a convenient abstraction for coordinating concurrent reads and writes of shared data in a concurrent or parallel system. Bingsheng Wang TM Operating Systems 7

Example Transactional Memory Bingsheng Wang TM Operating Systems 8

Example Transactional Memory Bingsheng Wang TM Operating Systems 9

Mechanisms of Transactional Memory Manage the tentative work that a transaction does while it executes, akin the left and right fields of the qn object. Ensure isolation between transactions, detect and resolve conflicts Eager conflict detection : identifies conflicts when running. Lazy conflict detection : detect only when they try to commit. Bingsheng Wang TM Operating Systems 10

Integrated with high-level programming language Bingsheng Wang TM Operating Systems 11

Software Transactional Memory Transactional Memory A rich vein of research over the last decade, focusing on approaches that can be implemented on current mainstream processors. There is a very large space of different possible STM designs, and simple version-number-based approach is by no means the state of the art. Bingsheng Wang TM Operating Systems 12

Software Transactional Memory Transactional Memory Record the change into write-log and undo-log Record Version number into read-log Check conflicts based on version number and decide commit or abort. If commit, increase the version number. Bingsheng Wang TM Operating Systems 13

Hardware Transactional Memory Provide advantages over STM Lower overheads Better power and energy profiles Less invasive Strong isolation Identifying Transactional Locations: Via extensions to instruction set Explicitly transactional HTMs: more flexible Implicitly transactional HTMs: reuse Transactional Memory Tracking Read-Sets and Managing Write-Sets Extend the mechanisms of current caches and buffers to track read-sets and manage write-sets Bingsheng Wang TM Operating Systems 14

Hardware Transactional Memory Detecting Data Conflicts: Cache coherence protocol Transactional Memory Cache state: MESI (modified/exclusive/shared/invalid) Resolving Data Conflicts Eager conflict detection: aborting the transaction on the processor that receives the conflicting request, and transferring control to software following such an abort. Managing Architectural Register State Create a shadow copy of architectural registers at the start of a transaction for restoration. Bingsheng Wang TM Operating Systems 15

Hardware Transactional Memory Transactional Memory Committing and Aborting HTM Transactions: making all transactional updates visible to other processors instantaneously Obtain the write permissions for all the transactional addresses Block any subsequent requests from other processors Drain the store buffer into the data cache Bingsheng Wang TM Operating Systems 16

Application Manage shared-memory data structures in which scalability is difficult to achieve via lock-based synchronization Some Examples Double-ended queue operations (PushLeft) Graph algorithms Quake game server Limitations The performance of code executing within a transaction can be markedly slower than the performance of normal code Parallel/Semantic errors Bingsheng Wang TM Operating Systems 17

Overall Conclusion Transactional Memory model provides an unlocked solution and an abstraction mechanism to parallel programming. Software Transactional Memory: coexist with other programming abstractions and depends on the environment. Hardware Transactional Memory: Efficient but application sensitive. Transactional Memory is not a panacea. Bingsheng Wang TM Operating Systems 18

Reference 1. Transactional Memory (Second Edition) Tim Harris, James Larus, Ravi Rajwar, Synthesis Lectures on Computer Architecture, Morgan & Claypool Publishers, 2010 2. Kunle Olukotun and Lance Hammond. The future of microprocessors. Queue, 3(7):26 29, 2005. DOI: 10.1145/1095408.1095418 1 3. A. S. Grove. Only the paranoid survive. Doubleday, 1996. 1 4. E. A. Lee, "The Problem with Threads," in IEEE Computer, 39(5):33-42, May 2006 as well as an EECS Technical Report, UCB/EECS-2006-1, January 2006. 5. Learning from Mistakes --- A Comprehensive Study on Real World Concurrency Bug Characteristics. Shan Lu, Soyeon Park, Eunsoo Seo, and Yuanyuan Zhou. 13th International Conference on Architecture Support for Programming Languages and Operating Systems (ASPLOS'08). 6. Maurice Herlihy and J. Eliot B. Moss. Transactional memory: architectural support for lockfree data structures. In ISCA 93: Proc. 20th Annual International Symposium on Computer Architecture, pages 289 300, May 1993. DOI: 10.1145/165123.165164 6, 17, 149, 155 7. David B. Lomet. Process structuring, synchronization, and recovery using atomic actions. In ACM Conference on Language Design for Reliable Software, pages 128 137, March 1977. DOI: 10.1145/800022.808319 6, 62 8. Janice M. Stone, Harold S. Stone, Phil Heidelberger, and John Turek. Multiple reservations and the Oklahoma update. IEEE Parallel & Distributed Technology, 1(4):58 71, November 1993. DOI: 10.1109/88.260295 6, 149, 150, 158 Bingsheng Wang TM Operating Systems 19