Eraser: A dynamic data race detector for multithreaded programs

Slides:



Advertisements
Similar presentations
Goldilocks: Efficiently Computing the Happens-Before Relation Using Locksets Tayfun Elmas 1, Shaz Qadeer 2, Serdar Tasiran 1 1 Koç University, İstanbul,
Advertisements

Verification of Multithreaded Object- Oriented Programs with Invariants Bart Jacobs, K. Rustan M. Leino, Wolfram Schulte.
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.
Mutual Exclusion.
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.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
TaintCheck and LockSet LBA Reading Group Presentation by Shimin Chen.
CS533 Concepts of Operating Systems Class 3 Data Races and the Case Against Threads.
1 Last Time: Locks & Semaphores Implementing locks Test & Set Busy waiting Block waiting Semaphores Generalization of locks.
CS533 Concepts of Operating Systems Class 3 Monitors.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
/ 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.
1 Concurrency: Deadlock and Starvation Chapter 6.
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
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.
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.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
Dynamic Data Race Detection. Sources Eraser: A Dynamic Data Race Detector for Multithreaded Programs –Stefan Savage, Michael Burrows, Greg Nelson, Patric.
11/18/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
Bugs (part 1) CPS210 Spring Papers  Bugs as Deviant Behavior: A General Approach to Inferring Errors in System Code  Dawson Engler  Eraser: A.
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.
1 Synchronization Threads communicate to ensure consistency If not: race condition (non-deterministic result) Accomplished by synchronization operations.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles Synchronization Emery Berger and Mark Corner University.
HARD: Hardware-Assisted lockset- based Race Detection P.Zhou, R.Teodorescu, Y.Zhou. HPCA’07 Shimin Chen LBA Reading Group Presentation.
1 Previous Lecture Overview  semaphores provide the first high-level synchronization abstraction that is possible to implement efficiently in OS. This.
Eraser: A dynamic Data Race Detector for Multithreaded Programs Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, Thomas Anderson Presenter:
CS4315A. Berrached:CMS:UHD1 Process Synchronization Chapter 8.
CS 153 Design of Operating Systems Winter 2016 Lecture 7: Synchronization.
CS533 Concepts of Operating Systems Class 2a Monitors.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Implementing Mutual Exclusion Andy Wang Operating Systems COP 4610 / CGS 5765.
Mutual Exclusion -- Addendum. Mutual Exclusion in Critical Sections.
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
Synchronization Questions answered in this lecture: Why is synchronization necessary? What are race conditions, critical sections, and atomic operations?
CS162 Section 2. True/False A thread needs to own a semaphore, meaning the thread has called semaphore.P(), before it can call semaphore.V() False: Any.
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
Presenter: Godmar Back
CS703 - Advanced Operating Systems
Healing Data Races On-The-Fly
CSE 120 Principles of Operating
CS703 – Advanced Operating Systems
Background on the need for Synchronization
CS533 Concepts of Operating Systems Class 3
Semaphores and Condition Variables
Monitors, Condition Variables, and Readers-Writers
Lecture 11: Mutual Exclusion
Lecture 2 Part 2 Process Synchronization
Implementing Mutual Exclusion
Concurrency: Mutual Exclusion and Process Synchronization
CS533 Concepts of Operating Systems Class 3
Implementing Mutual Exclusion
Lecture 11: Mutual Exclusion
CSE 153 Design of Operating Systems Winter 19
CS333 Intro to Operating Systems
Chapter 6: Synchronization Tools
50.530: Software Engineering
Atomicity, Mutex, and Locks
CSE 332: Concurrency and Locks
Presentation transcript:

Eraser: A dynamic data race detector for multithreaded programs S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson TOCS Nov. 97

Overview Dynamic data race detection tool – testing paradigm instead of static analysis. Checks that each shared memory access follows a consistent locking discipline Data race – when 2 concurrent threads access a shared variable and at least one is a write and the threads use no explicit synchronization to prevent simultaneous access. Effect will depend on interleaving

Previous Approaches: Lamport’s Happened-Before lock(mutex) v = v+1; unlock(mutex) Previous work If 2 threads access a shared variable and the accesses are not ordered by happens-before then potential race. lock(mutex) v = v+1; unlock(mutex)

Drawbacks of Happened-Before Difficult to implement efficiently – need per-thread information about access ordering to all shared memory locations. Highly dependent on scheduler – needs large number of test cases.

y=y+1; lock(mutex) v = v+1; unlock(mutex) Previous work If 2 threads access a shared variable and the accesses are not ordered by happens-before then potential race. Depends on scheduler lock(mutex) v = v+1; unlock(mutex) y=y+1;

lock(mutex) v = v+1; unlock(mutex) y=y+1; Previous work If 2 threads access a shared variable and the accesses are not ordered by happens-before then potential race. Depends on scheduler y=y+1; lock(mutex) v = v+1; unlock(mutex)

Idea in Eraser Checks that locking discipline is observed. That the same lock(s) is held whenever the shared data object is accessed. Infer which locks protect which data items

Lockset Algorithm C(v) – candidate locks for v locks-held(t) – set of locks held by thread t Lock refinement for each v, init C(v) to set of all locks On each access to v by thread t: C(v) = C(v) 3 locks-held(t) If C(v) = {} issue warning

Example lock(mu1) v=v+1 unlock(mu1) lock(mu2) unlock(mu2) locks-held C(v) {} {mu1, mu2} {mu1} {mu1} {} {mu2} lock(mu1) v=v+1 unlock(mu1) lock(mu2) unlock(mu2)

More Sophistication Initialization without locks Read-shared data (written only during init, read-only afterwards) Reader-writer locking (multiple readers) Don’t start until see a second thread Report only after it becomes write shared Change algorithm to reflect lock types On read of v by t: C(v) = C(v) 3 locks-held(t) On write of v by t: C(v) = C(v) 3 write-locks-held(t) False Alarms still possible

Per-Location State virgin exclusive shared C(v) updated, races reported wr, 1st thread Shared modified wr, new thread exclusive rd, wr, 1st thread wr rd, new thread shared C(v) updated, no race reporting

Implementation Binary rewriting used Add instrumentation to call Eraser runtime Each load and store updates C(v) Each Acquire and Release call updates locks-held(t) Calls to storage allocator initializes C(v) Storage explosion handled by table lookup and use of indexes to represent sets Shadow word holds index number Slowdown by factor of 10 to 30x Will change interleavings

Shadow Memory and Lockset Indexes

Common False Alarms - Annotations Memory reuse Private locks Benign races if (some_condition) { LOCK m DO if (some_condition) {stuff} END } EraseReuse – resets shadow word to virgin state Lock annotations EraserIgnoreOn() EraserIgnoreOff()

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.

An OK Race in AltaVista

Bad Race in Vesta

Core Loop of Lock-Coupling // ptr->lock.Acquire(); has been done before loop while (next != null & key > next->data) {next->lock.Acquire(); ptr->lock.Release(); ptr=next; next=ptr->next; } 2 4 6 8 null ptr next