Eraser: A dynamic Data Race Detector for Multithreaded Programs Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, Thomas Anderson Presenter:

Slides:



Advertisements
Similar presentations
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
Advertisements

Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community.
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.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO and THOMAS ANDERSON.
Dynamic Data Race Detection. Sources Eraser: A Dynamic Data Race Detector for Multithreaded Programs –Stefan Savage, Michael Burrows, Greg Nelson, Patric.
Today’s Agenda  Midterm: Nov 3 or 10  Finish Message Passing  Race Analysis Advanced Topics in Software Engineering 1.
An Case for an Interleaving Constrained Shared-Memory Multi- Processor CS6260 Biao xiong, Srikanth Bala.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
/ PSWLAB Atomizer: A Dynamic Atomicity Checker For Multithreaded Programs By Cormac Flanagan, Stephen N. Freund 24 th April, 2008 Hong,Shin.
CS444/CS544 Operating Systems Synchronization 2/16/2006 Prof. Searleman
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
Concurrency: Mutual Exclusion and Synchronization Why we need Mutual Exclusion? Classical examples: Bank Transactions:Read Account (A); Compute A = A +
TaintCheck and LockSet LBA Reading Group Presentation by Shimin Chen.
CS533 Concepts of Operating Systems Class 3 Data Races and the Case Against Threads.
Concurrency: Mutual Exclusion, Synchronization, Deadlock, and Starvation in Representative Operating Systems.
CS533 Concepts of Operating Systems Class 3 Monitors.
1 Concurrency: Deadlock and Starvation Chapter 6.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
Synchronization CSCI 444/544 Operating Systems Fall 2008.
/ PSWLAB Eraser: A Dynamic Data Race Detector for Multithreaded Programs By Stefan Savage et al 5 th Mar 2008 presented by Hong,Shin Eraser:
Monitors: An Operating System Structuring Concept
DETECTION OF POTENTIAL DEADLOCKS AND DATARACES ROZA GHAMARI Bogazici UniversityMarch 2009.
Concurrency: Deadlock and Starvation Chapter 6. Goal and approach Deadlock and starvation Underlying principles Solutions? –Prevention –Detection –Avoidance.
1 Concurrency: Deadlock and Starvation Chapter 6.
Chapter 6 Concurrency: Deadlock and Starvation Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
CS510 Concurrent Systems Introduction to Concurrency.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
The HDF Group Multi-threading in HDF5: Paths Forward Current implementation - Future directions May 30-31, 2012HDF5 Workshop at PSI 1.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO, and THOMAS ANDERSON Ethan.
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.
4061 Session 21 (4/3). Today Thread Synchronization –Condition Variables –Monitors –Read-Write Locks.
Dynamic Data Race Detection. Sources Eraser: A Dynamic Data Race Detector for Multithreaded Programs –Stefan Savage, Michael Burrows, Greg Nelson, Patric.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Concurrency & Dynamic Programming.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
13-1 Chapter 13 Concurrency Topics Introduction Introduction to Subprogram-Level Concurrency Semaphores Monitors Message Passing Java Threads C# Threads.
Detecting Atomicity Violations via Access Interleaving Invariants
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
HARD: Hardware-Assisted lockset- based Race Detection P.Zhou, R.Teodorescu, Y.Zhou. HPCA’07 Shimin Chen LBA Reading Group Presentation.
Practice Chapter Five.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
CS 153 Design of Operating Systems Winter 2016 Lecture 7: Synchronization.
CS533 Concepts of Operating Systems Class 2a Monitors.
CS510 Concurrent Systems Jonathan Walpole. Introduction to Concurrency.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Institute for Software Technology Professor Horst Cerjak, Roderick Bloem V&T 02Dynamic Algorithms for Concurrency Verification & Testing Dynamic.
Using Escape Analysis in Dynamic Data Race Detection Emma Harrington `15 Williams College
FastTrack: Efficient and Precise Dynamic Race Detection [FlFr09] Cormac Flanagan and Stephen N. Freund GNU OS Lab. 23-Jun-16 Ok-kyoon Ha.
Detecting Data Races in Multi-Threaded Programs
W4118 Operating Systems Instructor: Junfeng Yang.
Presenter: Godmar Back
Healing Data Races On-The-Fly
CS533 Concepts of Operating Systems Class 3
COP 4600 Operating Systems Fall 2010
Background and Motivation
CS533 Concepts of Operating Systems Class 3
Kernel Synchronization II
CSE 451: Operating Systems Autumn 2003 Lecture 7 Synchronization
CSE 451: Operating Systems Autumn 2005 Lecture 7 Synchronization
CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization
CS333 Intro to Operating Systems
50.530: Software Engineering
Eraser: A dynamic data race detector for multithreaded programs
Presentation transcript:

Eraser: A dynamic Data Race Detector for Multithreaded Programs Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, Thomas Anderson Presenter: Chao Kong EECS 582 – W161

Outline Introduction Previous works The Lockset Algorithm Eraser implementation Case Studies EECS 582 – W162

Introduction Multithreading is prevalent. Microsoft Word and Netscape Navigator Multithreaded programs easily produce timing-dependent data races caused by simple synchronization errors. EECS 582 – W163

Data Race A data race occurs when multiple concurrent threads access a shared variable : At least one access is a write No explicit mechanism to prevent simultaneous accesses EECS 582 – W164 Thread 1 Thread 2

Previous works Monitors: Avoid data races of shared variables which are static globals Sun’s lock_lint and Extended Static Checker for Modula-3 Work in dynamically allocated shared data Problematical: requires statically reasoning about the program’s semantics Happens-before EECS 582 – W165

Happens-before Happens-before relation Within single thread Between threads Accessing variables not ordered by happens-before relation leads to potential data race EECS 582 – W166 Thread 1 Thread 2

y := y+1; Lock(mu); v := v+1; Unlock(mu); Flaws of Happens-before Difficult to implement Requires per-thread information Dependent on the interleaving produced by the scheduler EECS 582 – W167 Lock(mu); v := v+1; Unlock(mu); y := y+1; Thread 1 Thread 2

y := y+1; Lock(mu); v := v+1; Unlock(mu); Flaws of Happens-before Difficult to implement Requires per-thread information Dependent on the interleaving produced by the scheduler EECS 582 – W168 Thread 1 Lock(mu); v := v+1; Unlock(mu); y := y+1; Thread 2

Lockset Algorithm Locking discipline Every shared variable is protected by some locks Infer protection relation Infer which locks protect which variable from execution history. EECS 582 – W169

Lockset Algorithm Example EECS 582 – W1610

Limitations Initialization shared variables are frequently initialized without holding a lock Read-shared Data Some shared variables are written during initialization only and are read-only thereafter Read-Write Locks Read-write locks allow multiple readers to access a shared variable, but allow only a single writer to do so. EECS 582 – W1611

Read-Write Locks EECS 582 – W1612 Lock(mu1); v := v+1; Lock(mu2); w=v; Unlock(mu2); Unlock(mu1); Lock(mu2); w := v; Unlock(mu2); Locks-held C(v) {mu1,mu2} {} {mu1,mu2} {mu2} {}

Refinement-I Initialization  Don’t start until see a second thread Read-shared Data  Report only after it becomes write shared EECS 582 – W1613

Refinement-II EECS 582 – W1614 Reader-writer locking  Change algorithm to reflect lock type Page 22

Read-Write Locks EECS 582 – W1615 Lock(mu1); v := v+1; Lock(mu2); w=v; Unlock(mu2); Unlock(mu1); Lock(mu2); w := v; Unlock(mu2); Locks-held C(v) {mu1,mu2} {} {mu1} {mu2} {}

Implementation Binary rewriting used  Add instrumentation to call Eraser runtime  Calls to storage allocator initializes C(v)  Each Acquire and Release call updates locks-held(t)  Each load and store updates C(v) Storage explosion handled by table lookup and use of indexes to represent set  Shadow word holds index number EECS 582 – W1616

Shadow Memory and Lockset Indexes EECS 582 – W1617

Performance Slowdown by factor of 10 to 30x overhead of making a procedure call at every load and store instruction change thread order affect the behavior of time-sensitive applications EECS 582 – W1618

Common false alarms - Annotations Memory reuse Private locks Benign race EECS 582 – W1619  EraserReuse(address,size) Resets shadow word to virgin state  Lock annotations EraserReadLock/Unlock(lock) EraserWriteLock/Unlock(lock)  EraserlgnoreOn() EraserlgnoreOff()

Races inside OS Using interrupt system to provide mutual exclusion – this implicitly locks everything affected (by interrupt level specified) Explicitly associate a lock with interrupt level – disabling interrupt is like acquiring that lock Signal and wait kind of synchronization V to signal for P which waits -- semaphore not “held” by thread. EECS 582 – W1620

A Race for optimization in AltaVista EECS 582 – W1621

Data Race in Vesta EECS 582 – W1622

Conclusion The paper describes a new tool, called Eraser, for dynamically detecting data races in lock-based multithreaded programs. The paper evaluates the performance and overhead of Eraser The paper tells the experience of detecting data race by several case studies. EECS 582 – W1623

Questions Thank you !!! EECS 582 – W1624