IBM T. J. Watson Research Center Conditions for Strong Synchronization Maged Michael IBM T J Watson Research Center Joint work with: Martin Vechev, Hagit.

Slides:



Advertisements
Similar presentations
Module 6: Process Synchronization
Advertisements

Basic Java Constructs and Data Types – Nuts and Bolts
Bounded Model Checking of Concurrent Data Types on Relaxed Memory Models: A Case Study Sebastian Burckhardt Rajeev Alur Milo M. K. Martin Department of.
Symmetric Multiprocessors: Synchronization and Sequential Consistency.
0 - 0.
Inherent limitations facilitate design and verification of concurrent programs Hagit Attiya Technion.
1 © R. Guerraoui Universal constructions R. Guerraoui Distributed Programming Laboratory.
Operating Systems: Monitors 1 Monitors (C.A.R. Hoare) higher level construct than semaphores a package of grouped procedures, variables and data i.e. object.
Dynamic Determinism Checking for Structured Parallelism Edwin Westbrook 1, Raghavan Raman 2, Jisheng Zhao 3, Zoran Budimlić 3, Vivek Sarkar 3 1 Kestrel.
3.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Process An operating system executes a variety of programs: Batch system.
Processes Management.
Operating Systems Part III: Process Management (Process Synchronization)
Hongjin Liang and Xinyu Feng
1 ECE734 VLSI Arrays for Digital Signal Processing Loop Transformation.
1 Chapter 4 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
Architecture-aware Analysis of Concurrent Software Rajeev Alur University of Pennsylvania Amir Pnueli Memorial Symposium New York University, May 2010.
CS 162 Memory Consistency Models. Memory operations are reordered to improve performance Hardware (e.g., store buffer, reorder buffer) Compiler (e.g.,
“FENDER” AUTOMATIC MEMORY FENCE INFERENCE Presented by Michael Kuperstein, Technion Joint work with Martin Vechev and Eran Yahav, IBM Research 1.
1 © R. Guerraoui The Power of Registers Prof R. Guerraoui Distributed Programming Laboratory.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Chapter 6: Process Synchronization
Background Concurrent access to shared data can lead to inconsistencies Maintaining data consistency among cooperating processes is critical What is wrong.
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.
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Elad Gidron, Idit Keidar, Dmitri Perelman, Yonathan Perez
Inherent limitations facilitate design & verification of concurrent programs Hagit Attiya Technion.
Formalisms and Verification for Transactional Memories Vasu Singh EPFL Switzerland.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
What Can Be Implemented Anonymously ? Paper by Rachid Guerraui and Eric Ruppert Presentation by Amir Anter 1.
Deriving Linearizable Fine-Grained Concurrent Objects Martin Vechev Eran Yahav IBM T. J. Watson Research Center Martin Vechev Eran Yahav IBM T. J. Watson.
1 Martin Vechev IBM T.J. Watson Research Center Joint work with: Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov, Maged Michael.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Who’s Afraid of a Big Bad Lock Nir Shavit Sun Labs at Oracle Joint work with Danny.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
CS510 Concurrent Systems Introduction to Concurrency.
Shared Memory Consistency Models: A Tutorial Sarita V. Adve Kouroush Ghrachorloo Western Research Laboratory September 1995.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago.
Martin Vechev Eran Yahav Greta Yorsh IBM T.J. Watson Research Center.
L AWS OF ORDER : EXPENSIVE SYNCHRONIZATION IN CONCURRENT ALGORITHMS CANNOT BE ELIMINATED POPL '11 Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov,
Internet Software Development Controlling Threads Paul J Krause.
6.852: Distributed Algorithms Spring, 2008 Class 13.
Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.
DISTRIBUTED ALGORITHMS AND SYSTEMS Spring 2014 Prof. Jennifer Welch CSCE
Common2 extended to stacks and unbound concurrency By:Yehuda Afek Eli Gafni Adam Morrison May 2007 Presentor: Dima Liahovitsky 1.
Fence Complexity in Concurrent Algorithms Petr Kuznetsov TU Berlin/DT-Labs.
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
Complexity Implications of Memory Models. Out-of-Order Execution Avoid with fences (and atomic operations) Shared memory processes reordering buffer Hagit.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Distributed Algorithms (22903) Lecturer: Danny Hendler The wait-free hierarchy and the universality of consensus This presentation is based on the book.
1 1 Nastaran Shafiei VERIFICATION OF A NON-BLOCKING ARRAY-BASED QUEUE ALGORITHM.
1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples.
An algorithm of Lock-free extensible hash table Yi Feng.
Concurrent Computing Seminar Introductory Lecture Instructor: Danny Hendler
Queue Locks and Local Spinning Some Slides based on: The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
CS510 Concurrent Systems Jonathan Walpole. Introduction to Concurrency.
Distributed Algorithms (22903)
Chapter 5: Process Synchronization
Challenges in Concurrent Computing
A Lock-Free Algorithm for Concurrent Bags
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Grades.
Sitting on a Fence: Complexity Implications of Memory Reordering
Chapter 6: Synchronization Tools
Presentation transcript:

IBM T. J. Watson Research Center Conditions for Strong Synchronization Maged Michael IBM T J Watson Research Center Joint work with: Martin Vechev, Hagit Attiya, Rachid Guerraoui, Danny Hendler, Petr Kuznetsov The Chemistry of Concurrent and Distributed Programming Mysore Park, February 16, 2011

2Maged Michael The Chemistry of Concurrent and Distributed Programming Motivation There are good algorithms with good features … except for the requirement of strong synchronization Are there conditions under which the avoidance of both RAW and AWAR is impossible? Atomic write after read (AWAR) Read after write order (RAW)

3Maged Michael The Chemistry of Concurrent and Distributed Programming Read After Write Order Write to a shared variable X followed by a read of a different shared variable Y (without an intervening write of Y by the same thread) flag[0] := true while flag[1]... Write X Read Y Modern multiprocessors may reorder the read before the write Write X RAW fence Read Y Entry section of Dekkers algorithm

4Maged Michael The Chemistry of Concurrent and Distributed Programming Atomic Write After Read A read of a shared variable followed by a write of some shared variable (possibly the same variable), where the read and the write are atomic CAS(X,expval,newval) atomically r := (X == expval) if r X := newval return r do oldval := X until CAS(X,oldval,oldval+1) return oldval Fetch and increment E.g., CAS, TAS, FAA, RMW operations.

5Maged Michael The Chemistry of Concurrent and Distributed Programming Strong Non-Commutativity A method m1 is strongly non-commutative if there exists a method m2 (possibly the same as m1), such that: –m1 influences m2, AND –m2 influences m1 Any linearizable implementation of a SNC method must contain strong synchronization

6Maged Michael The Chemistry of Concurrent and Distributed Programming Common Examples of SNC Methods Set –Add(v) : boolean // Returns true iff v was not in the set –Remove(v) : boolean // Returns true iff v was in the set LIFO Stack –Pop() : Value FIFO Queue –Dequeue() : Value CAS Data Type –CAS(expected,newval) : boolean Work Stealing –Take() : Task –Steal() : Task Counter –FetchAndAdd(v) : value

7Maged Michael The Chemistry of Concurrent and Distributed Programming Avoiding SNC: Idempotent Types –Non-deterministically, an operation may have no effect –No deterministic sequential specification –E.g., idempotent work stealing [PPoPP 2009] A task may be extracted more than once Conventional (non-idempotent) Take is SNC –SNC with Steal Idempotent Take is not SNC

8Maged Michael The Chemistry of Concurrent and Distributed Programming Avoiding SNC: Limited Concurrency –E.g., single-consumer FIFO queue Multi-consumer dequeue is SNC Single-consumer dequeue is not SNC

9Maged Michael The Chemistry of Concurrent and Distributed Programming Avoiding SNC: Limited API –E.g., Set Add without return value Set Add : boolean is SNC Set Add : void is not SNC –E.g., Counter Add without returning value FetchAndAdd : integer is SNC AtomicAdd : void is not SNC

10Maged Michael The Chemistry of Concurrent and Distributed Programming Implications Algorithm Design –Guidance on when avoiding RAW/AWAR is futile Hardware Design –Added motivation to lower overheads of RAW/AWAR API Design –Sometimes return values in APIs dictate RAW/AWAR Specifications and Correctness Conditions –Motivation to examine requirements of determinism and linearizability Formal Verification and Algorithm Synthesis –Avoid useless work on non-RAW/AWAR algorithms when RAW/AWAR is required

11Maged Michael The Chemistry of Concurrent and Distributed Programming SNC Executions (Ongoing) Adapting the definition of SNC to executions –Goal: Prove that strong synchronization is required for all SNC executions of SNC methods Examples: –Successful executions of TryLock –Successful executions of LIFO Stack Pop –Successful executions of CAS –Successful executions of FIFO Queue Dequeue –Successful executions of Work Stealing Take and Steal –(Successful) executions of FetchAndAdd –Successful executions of Set Add and Remove

12Maged Michael The Chemistry of Concurrent and Distributed Programming Summary When is it impossible to avoid both read-after-read (RAW) order and atomic write-after-read (AWAR ) operations? Strong non-commutativity Tradeoff between RAW/AWAR and relaxations in specification THANK YOU

13Maged Michael The Chemistry of Concurrent and Distributed Programming BACKUP

14Maged Michael The Chemistry of Concurrent and Distributed Programming Strong Non-Commutativity A method m1 is strongly non-commutative in a sequential specification Spec if there exists a method m2 (possibly the same as m1), and there exist histories base, s1, s2, s3, s4 such that: 1.s1 and s4 are complete invocations of m1 with entry(s1) = entry(s4) and exit(s1) exit(s4). 2.s2 and s3 are complete invocations of m2 with entry(s2) = entry(s3) and exit(s2) exit(s3). 3.proc(entry(s1)) proc(entry(s2)). 4.base is a complete sequential history in Spec. 5.base · s2 · s4 Spec. 6.base · s1 · s3 Spec.