Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.

Slides:



Advertisements
Similar presentations
Bounded Model Checking of Concurrent Data Types on Relaxed Memory Models: A Case Study Sebastian Burckhardt Rajeev Alur Milo M. K. Martin Department of.
Advertisements

Types for Atomicity Authors: Cormac Flanagan, UC Santa Cruz Stephen Freund, Marina Lifshin, Williams College Shaz Qadeer, Microsoft Research Presentation.
The complexity of predicting atomicity violations Azadeh Farzan Univ of Toronto P. Madhusudan Univ of Illinois at Urbana Champaign.
1 Chao Wang, Yu Yang*, Aarti Gupta, and Ganesh Gopalakrishnan* NEC Laboratories America, Princeton, NJ * University of Utah, Salt Lake City, UT Dynamic.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
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,
Race Directed Random Testing of Concurrent Programs KOUSHIK SEN - UNIVERSITY OF CALIFORNIA, BERKELEY PRESENTED BY – ARTHUR KIYANOVSKI – TECHNION, ISRAEL.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO and THOMAS ANDERSON.
Iterative Context Bounding for Systematic Testing of Multithreaded Programs Madan Musuvathi Shaz Qadeer Microsoft Research.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
Atomizer: A Dynamic Atomicity Checker For Multithreaded Programs Stephen Freund Williams College Cormac Flanagan University of California, Santa Cruz.
Scaling Model Checking of Dataraces Using Dynamic Information Ohad Shacham Tel Aviv University IBM Haifa Lab Mooly Sagiv Tel Aviv University Assaf Schuster.
Today’s Agenda  Midterm: Nov 3 or 10  Finish Message Passing  Race Analysis Advanced Topics in Software Engineering 1.
/ PSWLAB Atomizer: A Dynamic Atomicity Checker For Multithreaded Programs By Cormac Flanagan, Stephen N. Freund 24 th April, 2008 Hong,Shin.
CS 263 Course Project1 Survey: Type Systems for Race Detection and Atomicity Feng Zhou, 12/3/2003.
Atomicity Violation Detection Prof. Moonzoo Kim CS492B Analysis of Concurrent Programs.
S. Narayanasamy, Z. Wang, J. Tigani, A. Edwards, B. Calder UCSD and Microsoft PLDI 2007.
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
TaintCheck and LockSet LBA Reading Group Presentation by Shimin Chen.
CS533 Concepts of Operating Systems Class 3 Data Races and the Case Against Threads.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
C. FlanaganDynamic Analysis for Atomicity1. C. Flanagan2Dynamic Analysis for Atomicity Atomicity The method inc() is atomic if concurrent threads do not.
C. Flanagan1Atomicity for Reliable Concurrent Software - PLDI'05 Tutorial Atomicity for Reliable Concurrent Software Joint work with Stephen Freund Shaz.
Runtime Atomicity Analysis of Multi-threaded Programs Focus is on the paper: “Atomizer: A Dynamic Atomicity Checker for Multithreaded Programs” by C. Flanagan.
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 OpenMP -Example ICS 535 Design and Implementation.
CS533 Concepts of Operating Systems Class 3 Monitors.
Verifying Commit-Atomicity Using Model Checking Cormac Flanagan University of California, Santa Cruz.
Cormac Flanagan UC Santa Cruz Velodrome: A Sound and Complete Dynamic Atomicity Checker for Multithreaded Programs Jaeheon Yi UC Santa Cruz Stephen Freund.
/ PSWLAB Eraser: A Dynamic Data Race Detector for Multithreaded Programs By Stefan Savage et al 5 th Mar 2008 presented by Hong,Shin Eraser:
DETECTION OF POTENTIAL DEADLOCKS AND DATARACES ROZA GHAMARI Bogazici UniversityMarch 2009.
C. FlanaganType Systems for Multithreaded Software1 Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College Shaz Qadeer Microsoft Research.
Runtime Refinement Checking of Concurrent Data Structures (the VYRD project) Serdar Tasiran Koç University, Istanbul, Turkey Shaz Qadeer Microsoft Research,
Accelerating Precise Race Detection Using Commercially-Available Hardware Transactional Memory Support Serdar Tasiran Koc University, Istanbul, Turkey.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO, and THOMAS ANDERSON Ethan.
/ PSWLAB Type-Based Race Detection for J AVA by Cormac Flanagan, Stephen N. Freund 22 nd Feb 2008 presented by Hong,Shin Type-Based.
50.530: Software Engineering Sun Jun SUTD. Week 8: Race Detection.
COMP 111 Threads and concurrency Sept 28, Tufts University Computer Science2 Who is this guy? I am not Prof. Couch Obvious? Sam Guyer New assistant.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
Detecting and Eliminating Potential Violation of Sequential Consistency for concurrent C/C++ program Duan Yuelu, Feng Xiaobing, Pen-chung Yew.
Detecting Atomicity Violations via Access Interleaving Invariants
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
CAPP: Change-Aware Preemption Prioritization Vilas Jagannath, Qingzhou Luo, Darko Marinov Sep 6 th 2011.
HARD: Hardware-Assisted lockset- based Race Detection P.Zhou, R.Teodorescu, Y.Zhou. HPCA’07 Shimin Chen LBA Reading Group Presentation.
Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois
3/12/2013Computer Engg, IIT(BHU)1 OpenMP-1. OpenMP is a portable, multiprocessing API for shared memory computers OpenMP is not a “language” Instead,
Eraser: A dynamic Data Race Detector for Multithreaded Programs Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, Thomas Anderson Presenter:
Testing Concurrent Programs Sri Teja Basava Arpit Sud CSCI 5535: Fundamentals of Programming Languages University of Colorado at Boulder Spring 2010.
Detecting Data Races in Multi-Threaded Programs
Presenter: Godmar Back
Healing Data Races On-The-Fly
Memory Consistency Models
Memory Consistency Models
CS533 Concepts of Operating Systems Class 3
Computer Engg, IIT(BHU)
Yuan Yu(MSR) Tom Rodeheffer(MSR) Wei Chen(UC Berkeley) SOSP 2005
Effective Data-Race Detection for the Kernel
runtime verification Brief Overview Grigore Rosu
Concurrency Specification
Threads and Memory Models Hal Perkins Autumn 2011
Atomicity in Multithreaded Software
Threads and Memory Models Hal Perkins Autumn 2009
Threads Chapter 4.
CS533 Concepts of Operating Systems Class 3
Operating System Introduction.
Eraser: A dynamic data race detector for multithreaded programs
Presentation transcript:

Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004

Race conditions: A race condition occurs if two threads simultaneously access the same shared variable and one of the access is write. Atomicity: A block of code is ‘atomic’ if for every interleaved program execution, there is an equivalent execution with same overall behavior, within which the entire block executes without preemption when method is executed serially.. Techniques for verifying atomicity: Type systems Theorem proving Dynamic analysis Model checking

Dynamic analysis - Atomizer : A dynamic atomicity checker for multi- threaded programs was developed as a run time verification tool to check atomicity specification. -Instead of waiting for particular interleaving on which atomicity violation causes erroneous behavior, the checker actively looks for evidence of atomicity violation that may cause error under other interleaving -This analysis combines ideas from both * Lipton theory of reduction – Proof technique for verifying atomicity using information about race condition * Lockset algorithm – identifies race conditions

Lipton’s Reduction Let’s denote the instructions as follows: L for left-mover, R for right-mover, N for non-mover, B for both-mover Then any execution sequence matching the following regular expression is equivalent to an atomic one: Reducible Method: (R + B)* (N +  ) (L + B)* The Atomizer implements a relaxed instrumented semantics to accommodate benign race conditions

Lockset algorithm If a variable is consistently protected by some lock, this lock must be held during all accesses to that variable. Tracks lockset for each field where, lockset = set of locks held Dynamically, we can look at the set of protecting locks helds during each access so far, and keep track of their intersection –If the intersection is empty, there seems to be no consistent locking discipline - classify access as a non- mover –Otherwise, there seems to be a consistent locking discipline - classify access as a both-mover

Lockset algorithm On first access to the files: Lockset (field) = lock(current_thread) On all subsequent access to the field: Lockset (field) = Lockset(field) ∩ lock(current_thread) Empty lockset indicates race condition Lockset(field) = { }  RACE CONDITION

Lockset algorithm For each filed of each allocated object, Atomizer tracks a state reflecting the degree to which the field has been shared among multiple threads. The following states come up: -Thread local, - thread local(2), - Read-shared, - shared modified.

method() { …. }Instrumented Source code RunTime: Lockset Reduction Atomize r Compiler WARNING Atomizer Event stream

IMPLEMENTATION Identify blocks that are supposed to be atomic –use heuristics exported methods synchronized methods synchronized blocks –allow user annotations stop the checking if there are false bugs do additional checks by declaring atomic /*# atomic */ void getChars() {... }

IMPLEMENTATION Perform instrumentation on the source code level –could also be done at the bytecode level –Instrumented source code produces event stream during execution Analyze event stream –For each block that is supposed to be atomic, check whether there is an equivalent execution in which it is scheduled contiguously. –Run the Lockset and Reduction algorithm Then, warn user if supposedly atomic block does not belong to this class.

Conclusion: - Atomizer detects the errors missed by the standard race detectors. -Produces fewer false alarms on benign races which do not cause atomicity violations. -Avoids the overhead of type annotations or type inferences. -Results suggest that large number of exported methods in benchmark are atomic. -Atomicity is the fundamental design principle in many multi-threaded systems.

Thank You