Pallavi Joshi* Mayur Naik † Koushik Sen* David Gay ‡ *UC Berkeley † Intel Labs Berkeley ‡ Google Inc.

Slides:



Advertisements
Similar presentations
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Pallavi Joshi  Chang-Seo Park  Koushik Sen  Mayur Naik ‡  Par Lab, EECS, UC Berkeley‡
Advertisements

Effective Static Deadlock Detection
1 Chao Wang, Yu Yang*, Aarti Gupta, and Ganesh Gopalakrishnan* NEC Laboratories America, Princeton, NJ * University of Utah, Salt Lake City, UT Dynamic.
Runtime Verification Ali Akkaya Boğaziçi University.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Conditional Must Not Aliasing for Static Race Detection Mayur Naik Alex Aiken Stanford University.
Goldilocks: Efficiently Computing the Happens-Before Relation Using Locksets Tayfun Elmas 1, Shaz Qadeer 2, Serdar Tasiran 1 1 Koç University, İstanbul,
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
Simulation Verification of Different Constraints in System Level Design in SystemC Piyush Ranjan Satapathy CS220 Class Project Presentation.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
ADVERSARIAL MEMORY FOR DETECTING DESTRUCTIVE RACES Cormac Flanagan & Stephen Freund UC Santa Cruz Williams College PLDI 2010 Slides by Michelle Goodstein.
© Andy Wellings, 2004 Roadmap  Introduction  Concurrent Programming  Communication and Synchronization  Completing the Java Model  Overview of the.
Mayur Naik Alex Aiken John Whaley Stanford University Effective Static Race Detection for Java.
Microsoft Research Faculty Summit Yuanyuan(YY) Zhou Associate Professor University of Illinois, Urbana-Champaign.
Partial Order Reduction for Scalable Testing of SystemC TLM Designs Sudipta Kundu, University of California, San Diego Malay Ganai, NEC Laboratories America.
Cormac Flanagan UC Santa Cruz Velodrome: A Sound and Complete Dynamic Atomicity Checker for Multithreaded Programs Jaeheon Yi UC Santa Cruz Stephen Freund.
Learning From Mistakes—A Comprehensive Study on Real World Concurrency Bug Characteristics Shan Lu, Soyeon Park, Eunsoo Seo and Yuanyuan Zhou Appeared.
Exceptions and Mistakes CSE788 John Eisenlohr. Big Question How can we improve the quality of concurrent software?
Testing Concurrent Programs COMP Production Programming Mathias Ricken Rice University Spring 2009.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Multi-core Programming Thread Profiler. 2 Tuning Threaded Code: Intel® Thread Profiler for Explicit Threads Topics Look at Intel® Thread Profiler features.
University of Maryland Bug Driven Bug Finding Chadd Williams.
Accelerating Precise Race Detection Using Commercially-Available Hardware Transactional Memory Support Serdar Tasiran Koc University, Istanbul, Turkey.
Lifecycle Verification of the NASA Ames K9 Rover Executive Dimitra Giannakopoulou Mike Lowry Corina Păsăreanu Rich Washington.
Deadlock Detection Nov 26, 2012 CS 8803 FPL 1. Part I Static Deadlock Detection Reference: Effective Static Deadlock Detection [ICSE’09]
1cs Intersection of Concurrent Accesses A fundamental property of Web sites: Concurrent accesses by multiple users Concurrent accesses intersect.
Survey on Trace Analyzer (2) Hong, Shin /34Survey on Trace Analyzer (2) KAIST.
What Change History Tells Us about Thread Synchronization RUI GU, GUOLIANG JIN, LINHAI SONG, LINJIE ZHU, SHAN LU UNIVERSITY OF WISCONSIN – MADISON, USA.
Use of Coverity & Valgrind in Geant4 Gabriele Cosmo.
1 (Worker Queues) cs What is a Thread Pool? A collection of threads that are created once (e.g. when a server starts) That is, no need to create.
Foundations of the C++ Concurrency Memory Model Hans-J. Boehm Sarita V. Adve HP Laboratories UIUC.
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.
Synchronized and Monitors. synchronized is a Java keyword to denote a block of code which must be executed atomically (uninterrupted). It can be applied.
Detecting and Eliminating Potential Violation of Sequential Consistency for concurrent C/C++ program Duan Yuelu, Feng Xiaobing, Pen-chung Yew.
Deadlock Analysis with Fewer False Positives Thread T1: sync(G){ sync(L1){ sync(L2){} } }; T3 = new T3(); j3.start(); J3.join(); sync(L2){ sync(L1){} }
Motivation  Parallel programming is difficult  Culprit: Non-determinism Interleaving of parallel threads But required to harness parallelism  Sequential.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Concurrency & Dynamic Programming.
StealthTest: Low Overhead Online Software Testing Using Transactional Memory Jayaram Bobba, Weiwei Xiong*, Luke Yen †, Mark D. Hill, and David A. Wood.
CS265: Dynamic Partial Order Reduction Koushik Sen UC Berkeley.
HXY Debugging Made by Contents 目录 History of Java MT Sequential & Parallel Different types of bugs Debugging skills.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
A visualisation and debugging tool for multi-active objects Ludovic Henrio, Justine Rochas LAMHA, Nov 2015.
Effective Static Deadlock Detection Mayur Naik* Chang-Seo Park +, Koushik Sen +, David Gay* *Intel Research, Berkeley + UC Berkeley.
CAPP: Change-Aware Preemption Prioritization Vilas Jagannath, Qingzhou Luo, Darko Marinov Sep 6 th 2011.
Deadlock Bug Detection Techniques Prof. Moonzoo Kim CS KAIST CS492B Analysis of Concurrent Programs 1.
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
Effective Static Deadlock Detection Mayur Naik (Intel Research) Chang-Seo Park and Koushik Sen (UC Berkeley) David Gay (Intel Research)
Execution Replay and Debugging. Contents Introduction Parallel program: set of co-operating processes Co-operation using –shared variables –message passing.
1 How to do Multithreading First step: Sampling and Hotspot hunting Myongji University Sugwon Hong 1.
Reachability Testing of Concurrent Programs1 Reachability Testing of Concurrent Programs Richard Carver, GMU Yu Lei, UTA.
Concurrency (Threads) Threads allow you to do tasks in parallel. In an unthreaded program, you code is executed procedurally from start to finish. In a.
Lecture 7 Discuss midterm Scheduling. Alternative Directory Structure See hw 1 and hw 2. This one more aligned with UNIX directory structure. Idea for.
Testing Concurrent Programs Sri Teja Basava Arpit Sud CSCI 5535: Fundamentals of Programming Languages University of Colorado at Boulder Spring 2010.
Where Testing Fails …. Problem Areas Stack Overflow Race Conditions Deadlock Timing Reentrancy.
Distributed Systems Lecture 6 Global states and snapshots 1.
Jeremy Nimmer, page 1 Automatic Generation of Program Specifications Jeremy Nimmer MIT Lab for Computer Science Joint work with.
Prescient Memory: Exposing Weak Memory Model Behavior by Looking into the Future MAN CAO JAKE ROEMER ARITRA SENGUPTA MICHAEL D. BOND 1.
Healing Data Races On-The-Fly
Formal methods: Lecture
About Me I'm a software Committer on HDFS
Why Events Are A Bad Idea (for high-concurrency servers)
runtime verification Brief Overview Grigore Rosu
References [1] LEAP:The Lightweight Deterministic Multi-processor Replay of Concurrent Java Programs [2] CLAP:Recording Local Executions to Reproduce.
Background and Motivation
Runtime Safety Analysis of Multithreaded Programs
Distributed Dynamic Channel Allocation in Wireless Network
Synchronization and liveness
Presentation transcript:

Pallavi Joshi* Mayur Naik † Koushik Sen* David Gay ‡ *UC Berkeley † Intel Labs Berkeley ‡ Google Inc

Motivation  Today’s concurrent programs are rife with deadlocks 6,500/198,000 (~ 3%) of bug reports in Sun’s bug database at are deadlocks  Deadlocks are difficult to detect Usually triggered non-deterministically, on specific thread schedules  Fixing other concurrency bugs like races can introduce new deadlocks Our past experience with reporting races: developers often ask for deadlock checker

Motivation  Most of previous deadlock detection work has focused on resource deadlocks  Example // Thread 1 // Thread 2 sync(L1) { sync(L2) { sync(L2) { sync(L1) { …. …. } } L1L1 T1T1 L2L2 T2T2

Motivation  Other kinds of deadlocks, e.g. communication deadlocks, are equally notorious  Example // Thread 1 // Thread 2 if(!b) { b = true; sync(L) { sync(L) { L.wait(); L.notify(); } } } T2T1 if(!b) wait L b = true notify L b is initially false

Goal  Build a dynamic analysis based tool that detects communication deadlocks scales to large programs has low false positive rate

Our Initial Effort  Take cue from existing dynamic analyses for other concurrency errors  Existing dynamic analyses check for the violation of an idiom Races ○ every shared variable is consistently protected by a lock Resource deadlocks ○ no cycle in lockgraph Atomicity violations ○ atomic blocks should have the pattern (R+B)*N(L+B)*

Our Initial Effort  Which idiom should we check for communication deadlocks?

Our Initial Effort  Recommended usage of condition variables // F1 // F2 sync (L) { sync (L) { while (!b) b = true; L.wait ();L.notifyAll (); assert (b == true); } }

Our Initial Effort  Recommended usage pattern (or idiom) based checking does not work  Example // Thread 1 // Thread 2 sync (L1) sync (L2) while (!b) L2.wait (); sync (L1) sync (L2) L2.notifyAll (); No violation of idiom, but still there is a deadlock!

Revisiting existing analyses  Relax the dependencies between relevant events from different threads verify all possible event orderings for errors use data structures to check idioms (vector clocks, lock-graphs etc.) to implicitly verify all event orderings

Revisiting existing analyses  Idiom based checking does not work for communication deadlocks  But, we can still explicitly verify all orderings of relevant events for deadlocks

Trace Program // Thread 1 // Thread 2 if (!b) { b = true; sync (L) { L.wait (); L.notify (); } } } b is initially false lock L wait L unlock L lock L unlock L notify L T1T2

Trace Program lock L wait L unlock L lock L unlock L notify L T1T2 Thread t1 { lock L; wait L; unlock L; } Thread t2 { lock L; notify L; unlock L; }

Trace Program lock L wait L unlock L lock L unlock L notify L T1T2 Thread t1 { Thread t2 { lock L; wait L; || notify L; unlock L; }

Trace Program  Built out of only a subset of events usually much smaller than original program  Throws away a lot of dependencies between threads could give false positives but increases coverage

Trace Program : Add Dependencies // Thread 1 // Thread 2 if (!b) { b = true; sync (L) { L.wait (); L.notify (); } } } b is initially false lock L wait L unlock L lock L unlock L notify L T1T2 if (!b) b = true

lock L wait L unlock L lock L unlock L notify L T1T2 if (!b) b = true Thread t1 { if (!b) { lock L; wait L; unlock L; } Thread t2 { b = true; lock L; notify L; unlock L; } Trace Program : Add Dependencies

Trace Program : Add Power  Use static analysis to add to the predictive power of the trace program // Thread 1 // Thread !b => L.wait() if (!b) { b = true; sync (L) { L.wait (); L.notify (); } } } b is initially false Thread t1 { if (!b) { lock L; wait L; unlock L; }

Trace Program : Other Errors  Effective for concurrency errors that cannot be detected using an idiom communication deadlocks, deadlocks because of exceptions, … // Thread 1 // Thread 2 while (!b) { try{ sync (L) { foo(); L.wait (); b = true; } sync (L) { L.notify(); } } } catch (Exception e) {…} b is initially false can throw an exception

Implementation and Evaluation  Implemented for deadlock detection both communication and resource deadlocks  Built a prototype tool for Java called CHECKMATE  Experimented with a number of Java libraries and applications log4j, pool, felix, lucene, jgroups, jruby....  Found both previously known and unknown deadlocks (17 in total)

Conclusion  CHECKMATE is a novel dynamic analysis for finding deadlocks both resource and communication deadlocks  Effective on a number of real-world Java benchmarks  Trace program based approach is generic can be applied to other errors, e.g. deadlocks because of exceptions