Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)

Slides:



Advertisements
Similar presentations
Fast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems Håkan Sundell Philippas Tsigas.
Advertisements

Database Concurrency Control and Recovery
Privatization Techniques for Software Transactional Memory Michael F. Spear, Virendra J. Marathe, Luke Dalessandro, and Michael L. Scott University of.
Wait-die Transactions given a timestamp when they arrive …. ts(T i ) T i can only wait for T j if ts(T i )< ts(T j )...else die T 1 (ts =10) T 2 (ts =20)
Introduction to Database Systems1 Concurrency Control CC.Lecture 1.
Reduction, abstraction, and atomicity: How much can we prove about concurrent programs using them? Serdar Tasiran Koç University Istanbul, Turkey Tayfun.
CS6223: Distributed Systems
1 Supplemental Notes: Practical Aspects of Transactions THIS MATERIAL IS OPTIONAL.
CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture X: Transactions.
Database Systems, 8 th Edition Concurrency Control with Time Stamping Methods Assigns global unique time stamp to each transaction Produces explicit.
Chapter 6 Process Synchronization: Part 2. Problems with Semaphores Correct use of semaphore operations may not be easy: –Suppose semaphore variable called.
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.
/ PSWLAB Atomizer: A Dynamic Atomicity Checker For Multithreaded Programs By Cormac Flanagan, Stephen N. Freund 24 th April, 2008 Hong,Shin.
Jan. 2014Dr. Yangjun Chen ACS Database recovery techniques (Ch. 21, 3 rd ed. – Ch. 19, 4 th and 5 th ed. – Ch. 23, 6 th ed.)
Nested Transactional Memory: Model and Preliminary Architecture Sketches J. Eliot B. Moss Antony L. Hosking.
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
Authors Eric Koskinen Maurice Herlihy Brown University Presented by – Nagashri Setty Checkpoints and Continuations instead of Nested Transactions (SPAA’08)
CS 582 / CMPE 481 Distributed Systems Concurrency Control.
1 Lecture 7: Transactional Memory Intro Topics: introduction to transactional memory, “lazy” implementation.
10 1 Chapter 10 Transaction Management and Concurrency Control Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Transaction Management and Concurrency Control
Optimistic CC Performance Evaluation Criterion 1. Degree of Concurrency Less reshuffle  High degree of concurrency 2. Resources used to recognize - Lock.
Supporting Nested Transactional Memory in LogTM Authors Michelle J Moravan Mark Hill Jayaram Bobba Ben Liblit Kevin Moore Michael Swift Luke Yen David.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Transaction Management and Concurrency Control.
System Catalogue v Stores data that describes each database v meta-data: – conceptual, logical, physical schema – mapping between schemata – info for query.
Recovery Basics. Types of Recovery Catastrophic – disk crash –Backup from tape; redo from log Non-catastrophic: inconsistent state –Undo some operations.
Relativistic Red Black Trees. Relativistic Programming Concurrent reading and writing improves performance and scalability – concurrent readers may disagree.
Data Concurrency Control And Data Recovery
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
VMCAI / POPL 2009 Spy Report. Topics of Interest (I) Semantics of concurrent programs – Programming languages & abstractions – Transactional memory (TM)
SafetyNet Improving the Availability of Shared Memory Multiprocessors with Global Checkpoint/Recovery Daniel J. Sorin, Milo M. K. Martin, Mark D. Hill,
Concurrency and Transaction Processing. Concurrency models 1. Pessimistic –avoids conflicts by acquiring locks on data that is being read, so no other.
Concurrency Server accesses data on behalf of client – series of operations is a transaction – transactions are atomic Several clients may invoke transactions.
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.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Distributed synchronization and mutual exclusion Distributed Transactions.
Concurrent Linked Lists and Linearizability Proofs Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Modified.
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Chapter 10 Recovery System. ACID Properties  Atomicity. Either all operations of the transaction are properly reflected in the database or none are.
Transaction Management Transparencies. ©Pearson Education 2009 Chapter 14 - Objectives Function and importance of transactions. Properties of transactions.
Priority Queues Dan Dvorin Based on ‘The Art of Multiprocessor Programming’, by Herlihy & Shavit, chapter 15.
Roman Manevich Rashid Kaleem Keshav Pingali University of Texas at Austin Synthesizing Concurrent Graph Data Structures: a Case Study.
9 1 Chapter 9_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
NOEA/IT - FEN: Databases/Transactions1 Transactions ACID Concurrency Control.
10 1 Chapter 10_B Concurrency Control Database Systems: Design, Implementation, and Management, Rob and Coronel.
Synchronization CSCI 4900/6900. Transactions Protects data and allows processes to access and modify multiple data items as a single atomic transaction.
Parallel Data Structures. Story so far Wirth’s motto –Algorithm + Data structure = Program So far, we have studied –parallelism in regular and irregular.
Simplifying Linearizability Proofs Using Reduction and Abstraction Serdar Tasiran Koc University, Istanbul, Turkey Tayfun Elmas, Ali Sezgin, Omer Subasi.
4 November 2005 CS 838 Presentation 1 Nested Transactional Memory: Model and Preliminary Sketches J. Eliot B. Moss and Antony L. Hosking Presented by:
CS411 Database Systems Kazuhiro Minami 16: Final Review Session.
Commutativity and Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)
Computer Science Lecture 13, page 1 CS677: Distributed OS Last Class: Canonical Problems Election algorithms –Bully algorithm –Ring algorithm Distributed.
Database Recovery Zheng (Godric) Gu. Transaction Concept Storage Structure Failure Classification Log-Based Recovery Deferred Database Modification Immediate.
Chapter 13 Managing Transactions and Concurrency Database Principles: Fundamentals of Design, Implementation, and Management Tenth Edition.
1 Concurrency Control. 2 Why Have Concurrent Processes? v Better transaction throughput, response time v Done via better utilization of resources: –While.
© Virtual University of Pakistan Database Management System Lecture - 43.
Database recovery techniques
Last Class: Canonical Problems
Part 2: Software-Based Approaches
Faster Data Structures in Transactional Memory using Three Paths
COS 418: Advanced Computer Systems Lecture 5 Michael Freedman
Assignment 4 - Solution Problem 1
Lecture 6: Transactions
Chapter 10 Transaction Management and Concurrency Control
Software Transactional Memory Should Not be Obstruction-Free
Concurrency in Smart Contracts
Concurrency control (OCC and MVCC)
Optimistic CC Performance
Parallel Data Structures
Presentation transcript:

Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)

TMW April 2010 Skew Heaps 0 1 Tree with “heap” property 2 4 3

TMW April 2010 Concurrent Skew Heap Insert me! 6

TMW April 2010 Concurrent Skew Heap Lock parent Swap R & L

TMW April 2010 Concurrent Skew Heap Lock right child Unlock parent 2

TMW April 2010 Concurrent Skew Heap No global rebalancing Good amortized performance Good concurrency

TMW April 2010 Transactional Skew Heap Insert me! 6

TMW April 2010 Transactional Skew Heap I wrote 0 Write-write conflict! Good concurrency with locking Not with transactions … Confusion between thread-level & transaction-level synchronization Confusion between thread-level & transaction-level synchronization

TMW April 2010 Coarse-Grained Synchronization Synchronize on high-level operations, Like add(), remove(), etc. … Not low-level reads and writes Synchronize on high-level operations, Like add(), remove(), etc. … Not low-level reads and writes Pessimistic: update in place, undo on abort Optimistic: update private copy, apply changes on commit But what is the meaning of conflict?

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs add(x)

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs add(x)

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs add(x)

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object rem(x) Undo Logs add(x) x

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object rem(x) Undo Logs add(x) x add(y) y

TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object rem(x) Undo Logs add(x) x member(x)

TMW April 2010 Pessimistic Boosting Thread-safe base object Updated in place Log Inverses Conflicting operations blocked by abstract locks What does it mean for operations to conflict?

TMW April 2010 Optimistic Boosting Black-box linearizable data object

TMW April 2010 Optimistic Boosting private copies Black-box linearizable data object

TMW April 2010 Optimistic Boosting redo logs private copies Black-box linearizable data object

TMW April 2010 Optimistic Boosting redo logs private copies Black-box linearizable data object add(x)

TMW April 2010 Optimistic Boosting add(x) redo logs private copies Black-box linearizable data object add(x) x

TMW April 2010 Optimistic Boosting add(x) add(y) redo logs private copies Black-box linearizable data object add(x) x add(y) y

TMW April 2010 On Commit add(x) add(y) redo logs private copies Black-box linearizable data object x y add(x)

TMW April 2010 On Commit add(x) add(y) redo logs private copies Black-box linearizable data object x y add(x) No conflict, apply updates to my copy x x

TMW April 2010 On Commit add(x) add(y) x y add(x) x x Different physical values, Same logical values

TMW April 2010 On Commit add(x) rem(x) redo logs private copies Black-box linearizable data object x add(x) Conflict! Abort & restore my copy x

TMW April 2010 Optimistic Boosting Thread-local object copies Deferred operatons kept in redo log No inverses On commit, broadcast deferred operations To other transactions, public copy On commit, broadcast deferred operations To other transactions, public copy Transactions snoop on broadcast, Abort if conflict detected Transactions snoop on broadcast, Abort if conflict detected What does it mean for operations to conflict?

TMW April 2010 Left-Movers time legal history

TMW April 2010 Left-Movers time If and are adjacent, Ok to move earlier

TMW April 2010 Left-Mover Example: Semaphore time inc()dec() 1 010

TMW April 2010 Inc() is Left-mover WRT Dec() time inc()dec()

TMW April 2010 Same sequence of calls (results unaffected) Left-Mover Example: Semaphore time inc()dec()

TMW April 2010 Same final state Left-Mover Example: Semaphore time inc()dec()

TMW April 2010 Left-Mover Counter-example time 1 dec() 0 inc() 1 dec() 0

TMW April 2010 Dec() not Left-Mover WRT Inc() time 1 dec() 0 inc() 1 dec() 0

TMW April 2010 Right-Movers time legal history

TMW April 2010 Right-Movers time If and are adjacent, Ok to move later

TMW April 2010 Commutativity time If and are adjacent, Ok to swap

What Theory? Sept Pessimistic Semantics (modify shared state in place) time Txn B beg Txn A beg Pessimistic Commit: Move Left of pending cmt

What Theory? Sept Pessimistic Semantics (modify shared state in place) time Txn B beg Txn A beg abt

What Theory? Sept Pessimistic Semantics (modify shared state in place) time 3 Txn B beg Txn A beg Pessimistic Abort: Move Right of pending Pessimistic Abort: Pending ops move Left

What Theory? Sept Pessimistic Semantics (modify shared state in place) Operations must be LEFT movers w.r.t. other pending operations On commit, move operations LEFT On abort, move operations RIGHT (free) and append inverses

What Theory? Sept Optimistic Semantics (modify local copies; merge) time Txn B Txn A beg Optimistic Commit: Move Right of committed cmt

What Theory? Sept Optimistic Semantics (modify local copies; merge) time Txn B Txn A beg Optimistic Abort: Discard Operations abt cmt

What Theory? Sept Operations must be RIGHT movers w.r.t. concurrently committed operations On commit, move operations RIGHT Abort if concurrent non-LM op On abort, discard local changes Optimistic Semantics (modify local copies; merge)

PessimisticOptimistic Two Execution Models What Theory? Sept Left-MovernessRight-Moverness Algebraic Abstract Properties

TMW April 2010 Challenges Automation? –Theorem proving –Model checking Compiler & Language support? Implementation …