Using Escape Analysis in Dynamic Data Race Detection Emma Harrington `15 Williams College

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

CS492B Analysis of Concurrent Programs Lock Basics Jaehyuk Huh Computer Science, KAIST.
Goldilocks: Efficiently Computing the Happens-Before Relation Using Locksets Tayfun Elmas 1, Shaz Qadeer 2, Serdar Tasiran 1 1 Koç University, İstanbul,
Verification of Multithreaded Object- Oriented Programs with Invariants Bart Jacobs, K. Rustan M. Leino, Wolfram Schulte.
Scalable and Precise Dynamic Datarace Detection for Structured Parallelism Raghavan RamanJisheng ZhaoVivek Sarkar Rice University June 13, 2012 Martin.
D u k e S y s t e m s Time, clocks, and consistency and the JMM Jeff Chase Duke University.
Lecture 5 Concurrency and Process/Thread Synchronization     Mutual Exclusion         Dekker's Algorithm         Lamport's Bakery Algorithm.
Mutual Exclusion.
Concurrency 101 Shared state. Part 1: General Concepts 2.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO and THOMAS ANDERSON.
Scaling Model Checking of Dataraces Using Dynamic Information Ohad Shacham Tel Aviv University IBM Haifa Lab Mooly Sagiv Tel Aviv University Assaf Schuster.
CS 263 Course Project1 Survey: Type Systems for Race Detection and Atomicity Feng Zhou, 12/3/2003.
CS444/CS544 Operating Systems Synchronization 2/16/2006 Prof. Searleman
ADVERSARIAL MEMORY FOR DETECTING DESTRUCTIVE RACES Cormac Flanagan & Stephen Freund UC Santa Cruz Williams College PLDI 2010 Slides by Michelle Goodstein.
Cormac Flanagan and Stephen Freund PLDI 2009 Slides by Michelle Goodstein 07/26/10.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
1 An Efficient On-the-Fly Cycle Collection Harel Paz, Erez Petrank - Technion, Israel David F. Bacon, V. T. Rajan - IBM T.J. Watson Research Center Elliot.
PRASHANTHI NARAYAN NETTEM.
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.
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
C. FlanaganType Systems for Multithreaded Software1 Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College Shaz Qadeer Microsoft Research.
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
Accelerating Precise Race Detection Using Commercially-Available Hardware Transactional Memory Support Serdar Tasiran Koc University, Istanbul, Turkey.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
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.
111 © 2002, Cisco Systems, Inc. All rights reserved.
Dynamic Analysis of Multithreaded Java Programs Dr. Abhik Roychoudhury National University of Singapore.
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.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
DOUBLE INSTANCE LOCKING A concurrency pattern with Lock-Free read operations Pedro Ramalhete Andreia Correia November 2013.
Drinking from Both Glasses: Adaptively Combining Pessimistic and Optimistic Synchronization for Efficient Parallel Runtime Support Man Cao Minjia Zhang.
Dr. R R DOCSIT, Dr BAMU. Basic Java :Multi Threading Cont. 2 Objectives of This Session Explain Synchronization in threads Demonstrate use of.
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
Threads. Readings r Silberschatz et al : Chapter 4.
Lecture 3 Concurrency and Thread Synchronization     Mutual Exclusion         Dekker's Algorithm         Lamport's Bakery Algorithm.
Aritra Sengupta, Man Cao, Michael D. Bond and Milind Kulkarni PPPJ 2015, Melbourne, Florida, USA Toward Efficient Strong Memory Model Support for the Java.
Eraser: A dynamic Data Race Detector for Multithreaded Programs Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, Thomas Anderson Presenter:
CS 153 Design of Operating Systems Winter 2016 Lecture 7: Synchronization.
SMP Basics KeyStone Training Multicore Applications Literature Number: SPRPxxx 1.
Linux Kernel Development Chapter 8. Kernel Synchronization Introduction Geum-Seo Koo Fri. Operating System Lab.
FastTrack: Efficient and Precise Dynamic Race Detection [FlFr09] Cormac Flanagan and Stephen N. Freund GNU OS Lab. 23-Jun-16 Ok-kyoon Ha.
Presenter: Godmar Back
Healing Data Races On-The-Fly
Multithreading / Concurrency
Critical sections, locking, monitors, etc.
Effective Data-Race Detection for the Kernel
Concepts of programming languages
Chapter 7: Deadlocks Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
143a discussion session week 3
Atomicity in Multithreaded Software
Multithreading.
Dr. Mustafa Cem Kasapbaşı
Concurrency: Mutual Exclusion and Process Synchronization
Created By: Asst. Prof. Ashish Shah, J.M.Patel College, Goregoan West
CSE 451: Operating Systems Winter 2007 Module 6 Synchronization
CSE 451: Operating Systems Autumn 2004 Module 6 Synchronization
CSE 451: Operating Systems Autumn 2003 Lecture 7 Synchronization
CSE 451: Operating Systems Autumn 2005 Lecture 7 Synchronization
CSE 451: Operating Systems Winter 2004 Module 6 Synchronization
CSE 451: Operating Systems Winter 2003 Lecture 7 Synchronization
Threads and Multithreading
CSE 451: Operating Systems Winter 2007 Module 6 Synchronization
CSE 451: Operating Systems Autumn 2009 Module 7 Synchronization
CSE 332: Concurrency and Locks
Eraser: A dynamic data race detector for multithreaded programs
Presentation transcript:

Using Escape Analysis in Dynamic Data Race Detection Emma Harrington `15 Williams College

Multithreaded programs can utilize multiple cores. But at the cost of greater programming complexity.

Multithreaded programming can be awkward… Some resources should never be used simultaneously. Thread interference occurs when two threads access a shared resource without proper coordination.

Thread 1Thread 2 bal = t t1 = bal t2 = bal bal = t Thread 1Thread 2 bal = t t1 = bal t2 = bal bal = t Race Condition = two concurrent unsynchronized accesses with at least one write Thread 1 … t1 = bal; bal = t1 + 10; … Thread 2 … t2 = bal; bal = t2 - 10; … Multithreaded programming can be awkward…

Locks prevent interference. Programmers use mutual exclusion locks to protect shared resources in multithreaded environments.

We can use locks to prevent race conditions Thread 1 … acq(m); t1 = bal; bal = t1 + 10; rel(m); … Thread 2 … acq(m); t2 = bal; bal = t2 – 10; rel(m); … Thread 1Thread 2 t1 = bal bal = t rel(m) t2 = bal acq(m) bal = t acq(m) rel(m)

It’s easy to forget a lock and leave a resource unprotected. Thread 1 … t1 = bal; bal = t1 + 10; … Thread 2 … acq(m); t2 = bal; bal = t2 – 10; rel(m); … Thread 1Thread 2 t1 = bal bal = t t2 = bal bal = t acq(m) rel(m)

Dynamic Race Detection x = 0 rel(m) acq(m) x = 1 x = 2 Thread A Thread B... Data Race Goal: Identify race conditions automatically Method: Monitor program as it runs. Check that conflicting memory accesses are ordered by synchronization. Uses Lamport HB relation. Can be efficiently represented in VCs [DJIT + ][FastTrack].

How do dynamic race detectors work? Thread 1Thread 2 t1 = bal bal = t rel(m) t2 = bal acq(m) bal = t acq(m) rel(m)

Thread 1Thread 2 bal = t t1 = bal t2 = bal bal = t No ordering of these writes. How do dynamic race detectors work?

When there are many sensitive resources and many accesses, checking can be expensive (~10x).

BalanceName Account Balance Name Account Dynamic Escape Analysis Everything written to a shared variable must become shared. All shared variables must be tracked by the race checker. Everything written to a shared variable must become shared. All shared variables must be tracked by the race checker. Thread 1Thread 2 bal ATM Bank ATM bal Thread 1Thread 2 bal ATM Bank ATM bal Thread 1Thread 2 bal ATM Bank ATM bal Thread 1Thread 2 bal ATM Bank ATM bal Bank Teller BalanceName Account … ATM Bank BalanceName Account

Dynamic Escape Analysis Algorithm Objects are either shared or local Storing a reference to a thread local object in a shared object makes it and all objects reachable from it shared. Local objects are accessible from one thread. Shared objects are accessible from multiple threads.

How common are local objects and accesses? In a suite of 11 multithreaded Java benchmarks, about 40% of accesses are local and can be safely ignored by dynamic race detectors. I wrote my dynamic escape analysis tool for the RoadRunner Testing Framework [Flanagan and Freund 2010]. Q: A:

Q: A: FastTrack [Flanagan and Freund 2009] Dynamic Escape Analysis Does eliminating checks on local accesses speed up race detection? (Run time / FastTrack Run Time)

By adding a static escape analysis, can we improve these results? Q: A: FastTrack [Flanagan and Freund 2009] Static and Dynamic Escape Analysis Dynamic Escape Analysis For the static escape analysis, I used IBM’s WALA thread-local analysis that identifies classes where every instance is only accessible from its creating thread. (Run time / FastTrack Run Time)

Contributions Race detectors spend a significant amount of time checking accesses to thread-local data that are inherently race free. Dynamic escape analysis identifies accesses that race detectors can ignore. Dynamic escape analysis can be augmented with static information to improve performance.

Future Work Use extra cores or the GPU to reduce the overhead by offloading the heap traversal required by dynamic escape analysis. Build into the garbage collector, which already efficiently traverses the heap. Utilize the garbage collector, which must identify garbage objects reachable from no threads. Use multiple cores or the GPU to reduce the overhead of the dynamic escape analysis.