Guy Golan-GuetaTel-Aviv University Nathan Bronson Stanford University Alex Aiken Stanford University G. Ramalingam Microsoft Research Mooly Sagiv Tel-Aviv.

Slides:



Advertisements
Similar presentations
Inferring Locks for Atomic Sections Cornell University (summer intern at Microsoft Research) Microsoft Research Sigmund CheremTrishul ChilimbiSumit Gulwani.
Advertisements

The following 5 questions are about VOLTAGE DIVIDERS. You have 20 seconds for each question What is the voltage at the point X ? A9v B5v C0v D10v Question.
Inherent limitations facilitate design and verification of concurrent programs Hagit Attiya Technion.
Concurrent programming for dummies (and smart people too) Tim Harris & Keir Fraser.
Reliable and Efficient Programming Abstractions for Sensor Networks Nupur Kothari, Ramki Gummadi (USC), Todd Millstein (UCLA) and Ramesh Govindan (USC)
Data Structures1 Basic Data Structures Elementary Structures Arrays Lists Search Structures Binary search Tree Hash Tables Sequence Structures Stacks Queues.
Principles of Transaction Management. Outline Transaction concepts & protocols Performance impact of concurrency control Performance tuning.
Reduction, abstraction, and atomicity: How much can we prove about concurrent programs using them? Serdar Tasiran Koç University Istanbul, Turkey Tayfun.
Goldilocks: Efficiently Computing the Happens-Before Relation Using Locksets Tayfun Elmas 1, Shaz Qadeer 2, Serdar Tasiran 1 1 Koç University, İstanbul,
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Inherent limitations facilitate design & verification of concurrent programs Hagit Attiya Technion.
Transactional Memory Overview Olatunji Ruwase Fall 2007 Oct
Steven Pelley, Peter M. Chen, Thomas F. Wenisch University of Michigan
/ PSWLAB Atomizer: A Dynamic Atomicity Checker For Multithreaded Programs By Cormac Flanagan, Stephen N. Freund 24 th April, 2008 Hong,Shin.
Sequential reductions for verifying serializability Hagit Attiya Technion & EPFL G. RamalingamMSR India Noam Rinetzky University of London.
Sequential reductions for verifying serializability Hagit Attiya Technion & EPFL G. RamalingamMSR India Noam Rinetzky University of London.
Progress Guarantee for Parallel Programs via Bounded Lock-Freedom Erez Petrank – Technion Madanlal Musuvathi- Microsoft Bjarne Steensgaard - Microsoft.
“THREADS CANNOT BE IMPLEMENTED AS A LIBRARY” HANS-J. BOEHM, HP LABS Presented by Seema Saijpaul CS-510.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
©Silberschatz, Korth and Sudarshan16.1Database System Concepts 3 rd Edition Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols.
Local Heap Shape Analysis Noam Rinetzky Tel Aviv University Joint work with Jörg Bauer Universität des Saarlandes Thomas Reps University of Wisconsin Mooly.
Concurrency CS 510: Programming Languages David Walker.
Programming Language Semantics Java Threads and Locks Informal Introduction The Java Specification Language Chapter 17.
Modular Shape Analysis for Dynamically Encapsulated Programs Noam Rinetzky Tel Aviv University Arnd Poetzsch-HeffterUniversität Kaiserlauten Ganesan RamalingamMicrosoft.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Sharing Objects – Ch. 3 Visibility What is the source of the issue? Volatile Dekker’s algorithm Publication and Escape Thread Confinement Immutability.
Verifying Commit-Atomicity Using Model Checking Cormac Flanagan University of California, Santa Cruz.
Modular Shape Analysis for Dynamically Encapsulated Programs Noam Rinetzky Tel Aviv University Arnd Poetzsch-HeffterUniversität Kaiserlauten Ganesan RamalingamMicrosoft.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
Presentation Topic 18.7 of Book Tree Protocol Submitted to: Prof. Dr. T.Y.LIN Submitted By :Saurabh Vishal.
C. FlanaganType Systems for Multithreaded Software1 Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College Shaz Qadeer Microsoft Research.
CS510 Concurrent Systems Introduction to Concurrency.
Verifying Atomicity via Data Independence Ohad Shacham Yahoo Labs, Israel Eran Yahav Technion, Israel Guy Gueta Yahoo Labs, Israel Alex Aiken Stanford.
Testing and Verifying Atomicity of Composed Concurrent Operations Ohad Shacham Tel Aviv University Nathan Bronson Stanford University Alex Aiken Stanford.
Shape Analysis Overview presented by Greta Yorsh.
1 Concurrency Control II: Locking and Isolation Levels.
Colorama: Architectural Support for Data-Centric Synchronization Luis Ceze, Pablo Montesinos, Christoph von Praun, and Josep Torrellas, HPCA 2007 Shimin.
Aritra Sengupta, Swarnendu Biswas, Minjia Zhang, Michael D. Bond and Milind Kulkarni ASPLOS 2015, ISTANBUL, TURKEY Hybrid Static-Dynamic Analysis for Statically.
Transactions and Concurrency Control. Concurrent Accesses to an Object Multiple threads Atomic operations Thread communication Fairness.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
CS510 Concurrent Systems Jonathan Walpole. Introduction to Concurrency.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Process Synchronization.
Reduction Theorems for Proving Serializability with Application to RCU-Based Synchronization Hagit Attiya Technion Work with Ramalingam and Rinetzky (POPL.
Distributed Transactions What is a transaction? (A sequence of server operations that must be carried out atomically ) ACID properties - what are these.
ECE 1747: Parallel Programming Short Introduction to Transactions and Transactional Memory (a.k.a. Speculative Synchronization)
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.
O-structures: Tracking Fine-grain, Inter-task Dependencies in Memory (towards hardware support for tasks) Yoav Etsion Technion In collaboration with:
Transactional Libraries
Concurrency Control Techniques
Compositional Pointer and Escape Analysis for Java Programs
CS422 Principles of Database Systems Concurrency Control
Faster Data Structures in Transactional Memory using Three Paths
Amir Kamil and Katherine Yelick
Concurrency Specification
Threads and Memory Models Hal Perkins Autumn 2011
Changing thread semantics
Kernel Synchronization II
Atomicity in Multithreaded Software
Threading And Parallel Programming Constructs
Threads and Memory Models Hal Perkins Autumn 2009
Does Hardware Transactional Memory Change Everything?
Locking Protocols & Software Transactional Memory
Kernel Synchronization II
Amir Kamil and Katherine Yelick
Deferred Runtime Pipelining for contentious multicore transactions
CSE 332: Concurrency and Locks
Controlled Interleaving for Transactions
Presentation transcript:

Guy Golan-GuetaTel-Aviv University Nathan Bronson Stanford University Alex Aiken Stanford University G. Ramalingam Microsoft Research Mooly Sagiv Tel-Aviv University Eran Yahav Technion Automatic Fine-Grained Synchronization via Domination Locking

Creating Highly Concurrent Data-Structures Given a sequential implementation of a data- structure Automatically create a correct highly concurrent version of this data-structure

Creating Highly Concurrent Data-Structures via Fine-Grained Locking Automatically add locks to guarantee: Correctness Atomicity Deadlock freedom High level of parallelism Fine-grained locks, lock for each object A lock is only held while necessary

Creating Highly Concurrent Data-Structures via Fine-Grained Locking Automatically add locks to guarantee: Correctness Atomicity Deadlock freedom High level of parallelism Fine-grained locks, lock for each object A lock is only held while necessary n1 list n2 n3n4 early release

Example: remove from a balanced search-tree (Treap) When should I acquire and release each lock? Under what conditions?

Locking Protocol Enforce a locking protocol in the given code What locking protocol do we need to enforce? How to enforce this protocol in the given code?

What locking protocol? Two Phase Locking – Does not allow early release Tree/DAG locking – Assume that the objects graph is static Dynamic versions of Tree/DAG locking

What locking protocol? Two Phase Locking [Papadimitriou `1979] – Does not allow early release Tree/DAG locking [Kedem et al. ‘1981], [Silberschatz, et al. ‘1982] – Assume that the objects graph is static Dynamic versions of Tree/DAG locking [Chaudhri et al. ‘1995], [Attiya et al. ‘2010]

Our Approach: The Domination Locking Protocol Works for any shape Allows early release

Two types of objects Distinguishes between exposed and hidden objects Exposed objects – “roots” of data structures – may be pointed by transaction arguments Hidden objects – may not be pointed by transaction arguments – may be reachable via exposed objects List... exposedhidden void insert(List l, int k) {…}

Restricted Semantics Leverages the restricted semantics of software modules – thread can access n3 only after n1 & n2 exposedhidden n1 List n2 n3n4

Domination Locking 1.transaction t can access object only when holding its lock 2.an hidden object u can be acquired by t only if every path between an exposed object to u includes an object which is locked by t DS a1 a2 a3 a4 a5a6 a7

assume ≤ be a total order of objects 3.t can acquire an exposed object u, only if t has never acquired an exposed object v ≤ u t has never released a lock a1 DS A b1 DS B...

Concurrent Correctness from Sequential Conditions If every sequential execution satisfies DL and is able to terminate  concurrent operations are conflict-serializable and deadlock-free (Intuition similar to Rinetzky et. al POPL’10)

Automatic Locking A method to enforce DL when shape== forest – add locking by relying on the restricted shape – without understanding the details of the given code

Example: remove from a balanced search-tree (Treap)

Forest-Based Data-Structure In every sequential execution, shape is a forest at the beginning and end of transactions

Forest-Based Data-Structure In every sequential execution, shape is a forest at the beginning and end of transactions Example: b3 List A List B b4 b2 b1 a1 a2a3 a4 forest violation move a3 from List A to List B

Forest-Based Data Structure Consistent objects – exposed object has no predecessors – hidden object has 0 or 1 predecessors (unshared) A data-structure is forest-based if – In every sequential execution, all object are consistent at the beginning and end of transactions

Reference counters We add to two reference counters to objects Stack reference counter – counts number of incoming pointers from private memory (stack variables) Heap reference counter – counts number of incoming pointers from heap objects

s=0 h=0 s=0 h=1 s=0 h=2s=1 h=1 s=1 h=0 yx Reference counters

Locking Acquire object u when – stack counter of u becomes positive Release object u when – stack counter of u becomes 0 – u is consistent

s=0 h=0 s=0 h=1 s=1 h=1s=0 h=1 s=1 h=0 xy

s=0 h=0 s=0 h=1 s=1 h=2s=0 h=1 s=1 h=0 xy

s=0 h=0 s=0 h=1 s=0 h=2s=1 h=1 s=1 h=0 yx

Locking Arguments void Move(List x, List y) { … Acquire *x and *y without leading to a deadlock – Define a unique identifier for each object e.g. use memory addresses – Acquire according the order of identifiers void Move(List x, List y) { { if( address(x) <= address(y) ) { acquire(x); acquire(y); } else { acquire(y); acquire(x); } …

RB tree (top-down implementation)

Treap

Apriori

Summary New Locking Protocol – Domination Locking – Applies to any shape – Allows early release Automatic realization for forest-based data- structures Preliminary Evaluation – Automatic fine-grained locking for red-black tree and others – Scales similarly to hand crafted locking

Thank You

Example: Sorted Linked List void Insert(SortedList list, int k) { Node p = list.Sentinel; Node c = p.next; while( c != null && c.k < k) { p = c ; c = c.next ; } n.next = c; p.next = n ; } n1 list n2 n3n4 void Insert(SortedList list, int k) { // original code + locking … } early release