A Programming Language View of Transactional Memory Hagit Attiya, Technion Joint work with Sandeep Hans, Alexey Gotsman and Noam Rinetzky Published in.

Slides:



Advertisements
Similar presentations
Impossibilities for Disjoint-Access Parallel Transactional Memory : Alessia Milani [Guerraoui & Kapalka, SPAA 08] [Attiya, Hillel & Milani, SPAA 09]
Advertisements

Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
Chapter 15: Transactions Transaction Concept Transaction Concept Concurrent Executions Concurrent Executions Serializability Serializability Testing for.
1 1 Regression Verification for Multi-Threaded Programs Sagar Chaki, SEI-Pittsburgh Arie Gurfinkel, SEI-Pittsburgh Ofer Strichman, Technion-Haifa Originally.
1 CS216 Advanced Database Systems Shivnath Babu Notes 11: Concurrency Control.
(c) Oded Shmueli Transactions Lecture 1: Introduction (Chapter 1, BHG) Modeling DB Systems.
Universität Karlsruhe (TH) © 2006 Univ,Karlsruhe, IPD, Prof. Lockemann/Prof. BöhmTAV 4 Chapter 4 Isolation: Correctness in the read/write model.
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.
Transactional Contention Management as a Non-Clairvoyant Scheduling Problem Alessia Milani [Attiya et al. PODC 06] [Attiya and Milani OPODIS 09]
Consistency Conditions for STM Sandeep Hans. Agenda Database Consistency Conditions STM Consistency Conditions A different perspective Consistency with.
CMPT 401 Summer 2007 Dr. Alexandra Fedorova Lecture X: Transactions.
Exploring the relations between STM and DB consistency conditions Sandeep Hans Technion Joint work with Hagit Attiya.
Quick Review of Apr 29 material
Sequential reductions for verifying serializability Hagit Attiya Technion & EPFL G. RamalingamMSR India Noam Rinetzky University of London.
A Mile-High View of Concurrent Algorithms Hagit Attiya Technion.
Sequential reductions for verifying serializability Hagit Attiya Technion & EPFL G. RamalingamMSR India Noam Rinetzky University of London.
Concurrent Transactions Even when there is no “failure,” several transactions can interact to turn a consistent state into an inconsistent state.
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
Introduction to Computability Theory
Idit Keidar and Dmitri Perelman Technion 1 SPAA 2009.
Concurrency control using transactions 1Transactions.
Formalisms and Verification for Transactional Memories Vasu Singh EPFL Switzerland.
Algorithmics for Software Transactional Memory Hagit Attiya Technion.
©Silberschatz, Korth and Sudarshan15.1Database System ConceptsTransactions Transaction Concept Transaction State Implementation of Atomicity and Durability.
Concurrency. Busy, busy, busy... In production environments, it is unlikely that we can limit our system to just one user at a time. – Consequently, it.
Transactions or Concurrency Control. Introduction A program which operates on a DB performs 2 kinds of operations: –Access to the Database (Read/Write)
Concurrency. Correctness Principle A transaction is atomic -- all or none property. If it executes partly, an invalid state is likely to result. A transaction,
The Cost of Privatization Hagit Attiya Eshcar Hillel Technion & EPFLTechnion.
Database Management Systems I Alex Coman, Winter 2006
1 Introduction to Transaction Processing (1)
Operational Semantics Semantics with Applications Chapter 2 H. Nielson and F. Nielson
A Behavioral Memory Model for the UPC Language Kathy Yelick Joint work with: Dan Bonachea, Jason Duell, Chuck Wallace.
An Introduction to Software Transactional Memory
08_Transactions_LECTURE2 DBMSs should guarantee ACID properties (Atomicity, Consistency, Isolation, Durability). This is typically done by guaranteeing.
Transactions Sylvia Huang CS 157B. Transaction A transaction is a unit of program execution that accesses and possibly updates various data items. A transaction.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
Distributed Transactions Chapter 13
©Silberschatz, Korth and Sudarshan15.1Database System Concepts Chapter 15: Transactions Transaction Concept Transaction State Implementation of Atomicity.
Shared Memory Consistency Models. SMP systems support shared memory abstraction: all processors see the whole memory and can perform memory operations.
Efficient Fork-Linearizable Access to Untrusted Shared Memory Presented by: Alex Shraer (Technion) IBM Zurich Research Laboratory Christian Cachin IBM.
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.
Chapter 14 Transactions Yonsei University 1 st Semester, 2015 Sanghyun Park.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
1 CSE 480: Database Systems Lecture 24: Concurrency Control.
Concurrency (cont.) Schedule. In multiprogramming environment, Several transaction run concurrently Database consistency can be destroy Schedules to ensure.
Operational Semantics Mooly Sagiv Tel Aviv University Textbook: Semantics with Applications Chapter.
Alpine Verification Meeting 2008 Model Checking Transactional Memories Vasu Singh (Joint work with Rachid Guerraoui, Tom Henzinger, Barbara Jobstmann)
Multidatabase Transaction Management COP5711. Multidatabase Transaction Management Outline Review - Transaction Processing Multidatabase Transaction Management.
1 Controlled concurrency Now we start looking at what kind of concurrency we should allow We first look at uncontrolled concurrency and see what happens.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
Jinze Liu. ACID Atomicity: TX’s are either completely done or not done at all Consistency: TX’s should leave the database in a consistent state Isolation:
Reduction Theorems for Proving Serializability with Application to RCU-Based Synchronization Hagit Attiya Technion Work with Ramalingam and Rinetzky (POPL.
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
Operational Semantics Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson
6/18/2016Transactional Information Systems3-1 Part II: Concurrency Control 3 Concurrency Control: Notions of Correctness for the Page Model 4 Concurrency.
Transactional Contention Management as a Non-Clairvoyant Scheduling Problem Hagit Attiya, Alessia Milani Technion, Haifa-LABRI, University of Bordeaux.
Transaction Management
(Nested) Open Memory Transactions in Haskell
CS216: Data-Intensive Computing Systems
On disjoint access parallelism
Transaction Processing
Transactions.
Transactions Properties.
Changing thread semantics
Transactions Sylvia Huang CS 157B.
Lecture 21: Concurrency & Locking
CPSC-608 Database Systems
UNIT -IV Transaction.
Presentation transcript:

A Programming Language View of Transactional Memory Hagit Attiya, Technion Joint work with Sandeep Hans, Alexey Gotsman and Noam Rinetzky Published in PODC 2013 & DISC 2014 Supported by MC-ITN Transform and Cost EuroTM

Transactional Memory Consistency The possible histories that a TM can exhibit Equivalent to a history where transactions execute atomically (explanation) Similar to serializability in databases Which transactions to explain, and which to consider in the explanation? Create new stack node nd res = abort while (res == abort) do { res = atomic { nd.next = Top.read() Top = node }

TM Consistency Conditions: Opacity All transactions (including live and aborted ones, unlike serializability) have a single explanation … res = atomic { Z = 1/(X-Y) abort } while (res == abort) do { res = atomic { l = Y X = l X = l-1 } [Guerraoui & Kapalka 08]

TM Consistency Conditions: Opacity All transactions (including live and aborted ones, unlike serializability) have a single explanation Preserve real-time order of transactions wait until G == 1 … while (res == abort) do { res = atomic { … } … while (res == abort) do { res = atomic { … } G = 1 [Guerraoui & Kapalka 08]

TM Consistency Conditions: Opacity All transactions (including live and aborted ones, unlike serializability) have a single explanation Can observe local variables of aborted transactions wait until G ≠ 1 lnd = G while (res == abort) do { nd = Top.read() } res = atomic { nd = Top.read() Top = Top.next abort } G = nd

TM Consistency Conditions: TMS One explanation for all committed transactions BUT Each response has an explanation including a (carefully picked) subset of the transactions Cannot observe local variables of aborted transactions wait until G ≠ 1 lnd = G while (res == abort) do { nd = Top.read() } res = atomic { nd = Top.read() Top = Top.next abort } G = nd [Doherty, Groves, Luchangco, Moir 09]

TM Consistency Conditions: TMS One explanation for all committed transactions BUT Each response has an explanation including a (carefully picked) subset of the transactions Cannot observe local variables of aborted transactions wait until G ≠ 1 lnd = G while (res == abort) do { nd = Top.read() } res = atomic { nd = Top.read() Top = Top.next abort } G = nd [Doherty, Groves, Luchangco, Moir 09] Formally prove that Opacity / TMS allow to program with atomicity in mind (sufficiency)? Is one of them the minimal condition for that (necessity)? Formally prove that Opacity / TMS allow to program with atomicity in mind (sufficiency)? Is one of them the minimal condition for that (necessity)?

The Right Consistency Condition? Must take the program context into account: If local variables are not rolled back after a transaction aborts (e.g., ScalaTM), Opacity is sufficient and necessary If they are rolled back, TMS is sufficient and necessary

The Right Consistency Condition? Must take the program context into account: Local actions: access only local variables Interface actions: interact with the TM Global actions: access global variables (not of the TM) only outside atomic blocks

Histories History: Finite sequence of interface actions Transactional Memory (TM): set of histories – well-formed, prefix-closed TM Atomic : each transaction appears in whole, without interleaving res req

Histories and Traces History: Finite sequence of interface actions Transactional Memory (TM): set of histories – well-formed, prefix-closed Trace: also includes non-transactional (local and global) actions val=9 G=7 val=8 val=3

Trace Equivalence Two traces are observationally equivalent  ~  ’ if threads see the same sequence of local values Possibly except for local values inside aborted transactions (because these are rolled back) TM C observationally refines TM Atomic if every trace  with history in TM C has a trace  ’ ~  with history in TM Atomic [He, Hoare, Sanders 86] val=9 G=7 val=8 val=3

Why Observational Refinement? Prove properties when running with TM Atomic and deduce them also for TM C Traces with history in TM C Traces with history in TM Atomic  ’’ ~ TM C observationally refines TM Atomic if every trace  with history in TM C has a trace  ’ ~  with history in TM Atomic

1 st Main Result TM C is opaque  TM C observationally refines TM Atomic

Every trace  whose history is in TM C has an equivalent trace  ’ whose history is in TM Atomic TM C is opaque  TM C observationally refines TM Atomic

Every trace  whose history is in TM C has an equivalent trace  ’ whose history is in TM Atomic H is opaque  has a “related” sequential history S Get a trace  ’ ~  of TM Atomic whose history is S trace  history H  TM C sequential history S ~ trace  ’

Every trace  whose history is in TM C has an equivalent trace  ’ whose history is in TM Atomic  Permute the actions of  to get  ’, while preserving the order of same-thread and global actions (inductively) trace  history H  TM C sequential history S ~ trace  ’

Permuted prefix of  so it is a prefix of a trace in TM Atomic  Locate , the next interface action in S, and move it  Reordering  relative to earlier actions in  may violate trace equivalence Sufficiency: Inductive Step trace  history H  TM C sequential history ~   

 (action of thread t) is not the beginning of a transaction Only local actions by t before  Move these actions, followed by  followed by actions by other threads Inductive Step: Simpler Case trace  sequential history ~   

 is the beginning of a transaction by thread t No interface actions by t before  Move actions outside transactions, followed by  followed by actions inside transactions (none by t) Inductive Step: The Other Case trace  sequential history ~   

Opacity is Necessary A program P H for every opaque history H Ensure that the real-time order between transactions in every trace of P H agrees with the real-time order of the transactions in H, using global variables Local variables record these order relations TM C is opaque  TM C observationally refines TM Atomic

If Local Variables are Rolled Back? Can only remember that an aborted transaction existed, but not what it read Necessity proof does not work  Adapted notion of trace equivalence  TMS: one explanation for all committed transactions, and possibly different one for each response of a live transaction

T1T1 TMS: Pick a Past T4T4 T5T5 T3T3  T2T2 C A C CP G 2 =2 G 1 =1 G 1 ==1? -For a response  : take its transaction and some transactions that started to commit (possibly pending or even unsuccessful) -If transaction T is included, include also all the committed transactions that precede T

T4T4 T1T1 TMS: Commit the Past T5T5 T3T3  T2T2 C A C -Commit included commit-pending transactions and replace abort with commit for included aborted transactions G 2 =2 G 1 =1 G 1 ==1? CP C

T1T1 TMS: Commit the Past T4T4 T5T5 T3T3  T2T2 C A C CP C -Remove all other transactions -Find an equivalent sequential execution -Preserving the real-time order G 2 =2 G 1 =1 G 1 ==1?

2nd Main Result Under rollback semantics TM C is TMS  TM C observationally refines TM Atomic

Sufficiency of TMS Similar to opacity, but a lot more complicated Construct an equivalent trace for each response TM C is TMS  TM C observationally refines TM Atomic

-Consider the beginning of the last included transaction -For every thread t, take the trace until the latest of: -The last non-transactional action before this point -The last transactional action of t in H’ The Equivalent Trace: Example T1T1 T4T4 T5T5 T3T3  T2T2 C A C CP C G 2 =2 G 1 =1 G 1 ==1?

TMS is Necessary Like opacity, but with a separate program for each response action  H Get a completed possible past that explains the history H (with some of the transaction) Use global variables to force real-time order between transactions

What Else? Extend the results to handle nesting and privatization Weaker observations (e.g., no global variables) are preserved by VWC? Stronger observations (e.g., global accesses inside a transaction) are preserved by deferred-update opacity or TMS2?