Guoliang Jin, Linhai Song, Wei Zhang, Shan Lu, and Ben Liblit University of Wisconsin–Madison Automated Atomicity- Violation Fixing.

Slides:



Advertisements
Similar presentations
A Technique for Parallel Reachability Analysis of Java Programs Raghuraman R. Sridhar Iyer G. Sajith.
Advertisements

Understanding and Detecting Real-World Performance Bugs
Transaction Management: Concurrency Control CS634 Class 17, Apr 7, 2014 Slides based on “Database Management Systems” 3 rd ed, Ramakrishnan and Gehrke.
An Case for an Interleaving Constrained Shared-Memory Multi-Processor Jie Yu and Satish Narayanasamy University of Michigan.
ECE 454 Computer Systems Programming Compiler and Optimization (I) Ding Yuan ECE Dept., University of Toronto
Ch 7 B.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
A Randomized Dynamic Program Analysis for Detecting Real Deadlocks Koushik Sen CS 265.
An Case for an Interleaving Constrained Shared-Memory Multi- Processor CS6260 Biao xiong, Srikanth Bala.
CMPT Dr. Alexandra Fedorova Lecture X: Transactions.
PARALLEL PROGRAMMING with TRANSACTIONAL MEMORY Pratibha Kona.
Vertically Integrated Analysis and Transformation for Embedded Software John Regehr University of Utah.
Microsoft Research Faculty Summit Yuanyuan(YY) Zhou Associate Professor University of Illinois, Urbana-Champaign.
Transaction Management
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
1 New Architectures Need New Languages A triumph of optimism over experience! Ian Watson 3 rd July 2009.
29-Jun-15 Java Concurrency. Definitions Parallel processes—two or more Threads are running simultaneously, on different cores (processors), in the same.
Distributed Systems Fall 2009 Distributed transactions.
© 1997 UW CSE 11/13/97N-1 Concurrency Control Chapter 18.1, 18.2, 18.5, 18.7.
Learning From Mistakes—A Comprehensive Study on Real World Concurrency Bug Characteristics Shan Lu, Soyeon Park, Eunsoo Seo and Yuanyuan Zhou Appeared.
University of Michigan Electrical Engineering and Computer Science 1 Practical Lock/Unlock Pairing for Concurrent Programs Hyoun Kyu Cho 1, Yin Wang 2,
Exceptions and Mistakes CSE788 John Eisenlohr. Big Question How can we improve the quality of concurrent software?
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
1 Thread Synchronization: Too Much Milk. 2 Implementing Critical Sections in Software Hard The following example will demonstrate the difficulty of providing.
Peng Liu and Charles Zhang Prism Research Group Department of Computer Science and Engineering Hong Kong University of Science and Technology 1.
Shared File Performance Improvements LDLM Lock Ahead Patrick Farrell
Threading and Concurrency Issues ● Creating Threads ● In Java ● Subclassing Thread ● Implementing Runnable ● Synchronization ● Immutable ● Synchronized.
LOOM: Bypassing Races in Live Applications with Execution Filters Jingyue Wu, Heming Cui, Junfeng Yang Columbia University 1.
School of Information Technologies Michael Cahill 1, Uwe Röhm and Alan Fekete School of IT, University of Sydney {mjc, roehm, Serializable.
Java Threads 11 Threading and Concurrent Programming in Java Introduction and Definitions D.W. Denbo Introduction and Definitions D.W. Denbo.
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.
Synchronization Transformations for Parallel Computing Pedro Diniz and Martin Rinard Department of Computer Science University of California, Santa Barbara.
Optimistic Design 1. Guarded Methods Do something based on the fact that one or more objects have particular states  Make a set of purchases assuming.
Static Program Analyses of DSP Software Systems Ramakrishnan Venkitaraman and Gopal Gupta.
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.
Colorama: Architectural Support for Data-Centric Synchronization Luis Ceze, Pablo Montesinos, Christoph von Praun, and Josep Torrellas, HPCA 2007 Shimin.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
11/18/20151 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam.
Kernel Locking Techniques by Robert Love presented by Scott Price.
Cooperative Concurrency Bug Isolation Guoliang Jin, Aditya Thakur, Ben Liblit, Shan Lu University of Wisconsin–Madison Instrumentation and Sampling Strategies.
Detecting and Eliminating Potential Violation of Sequential Consistency for concurrent C/C++ program Duan Yuelu, Feng Xiaobing, Pen-chung Yew.
SPL/2010 Guarded Methods and Waiting 1. SPL/2010 Reminder! ● Concurrency problem: asynchronous modifications to object states lead to failure of thread.
Monitors and Blocking Synchronization Dalia Cohn Alperovich Based on “The Art of Multiprocessor Programming” by Herlihy & Shavit, chapter 8.
Diagnosing and Fixing Concurrency Bugs Credits to Dr. Guoliang Jin, Computer Science, NC STATE Presented by Tao Wang.
CS533 – Spring Jeanie M. Schwenk Experiences and Processes and Monitors with Mesa What is Mesa? “Mesa is a strongly typed, block structured programming.
Practice Five Chapter Seven.
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.
Aditya Thakur Rathijit Sen Ben Liblit Shan Lu University of Wisconsin–Madison Workshop on Dynamic Analysis 2009 Cooperative Crug Isolation.
Effective Static Deadlock Detection Mayur Naik (Intel Research) Chang-Seo Park and Koushik Sen (UC Berkeley) David Gay (Intel Research)
Atom-Aid: Detecting and Surviving Atomicity Violations Brandon Lucia, Joseph Devietti, Karin Strauss and Luis Ceze LBA Reading Group 7/3/08 Slides by Michelle.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
Soyeon Park, Shan Lu, Yuanyuan Zhou UIUC Reading Group by Theo.
Automated Adaptive Bug Isolation using Dyninst Piramanayagam Arumuga Nainar, Prof. Ben Liblit University of Wisconsin-Madison.
Kernel Synchronization David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Learning from Mistakes: A Comprehensive Study on Real-World Concurrency Bug Characteristics Ben Shelton.
Healing Data Races On-The-Fly
Background on the need for Synchronization
Automated Atomicity-Violation Fixing
CSC 591/791 Reliable Software Systems
Faster Data Structures in Transactional Memory using Three Paths
Diagnosing and Fixing Concurrency Bugs
Amir Kamil and Katherine Yelick
Kernel Synchronization II
Threading And Parallel Programming Constructs
Amir Kamil and Katherine Yelick
Synchronization These notes introduce:
Presentation transcript:

Guoliang Jin, Linhai Song, Wei Zhang, Shan Lu, and Ben Liblit University of Wisconsin–Madison Automated Atomicity- Violation Fixing

Focus on Single-Variable Atomicity Bugs  Multicore era is coming already here  Programmers still struggle to reason about concurrency  Many ways to find and replay concurrency bugs  Atomizer, CTrigger, CCI, Kivati, Pacer, Falcon, …  But that’s still not a fix!  Automated fixer for single-variable atomicity bugs  Leverage variety of bug-finding tools  Static analyses & optimizations to patch one bug  Heuristics to merge & simplify groups of patches  Run-time validation during testing or post-deployment

Thread 2Thread 1 Collect Atomicity-Violation Triples read x write x p: read x c: read x r: write x pipi cici riri

Static Analyses to Construct One Patch p c

Lock Selection and Optimization  Any potentially-blocking operations in critical region?  No: wait forever when acquiring lock  Yes: time out when acquiring lock  Conservative over-approximation finds ad hoc spin loops  Is recursion possible within critical region?  No: use non-reentrant locks  Yes: use reentrant locks  Can we reach r while in the p–c critical region?  No: retain lock operations before/after r  Yes: remove lock operations before/after r  Try to reuse existing global lock (in practice, never)

Selective Fusion of Multiple Patches  Can improve performance and readability  Depends on costs of lock/unlock, thread count, contention, …  No statically-optimal answer  But some redundant operations are always good to remove  May be mandatory to avoid deadlocks  Merge if p 1, c 1, or r 1 are in any of patch 2’s critical regions  Heuristic, but works well in practice p1p1 p2p2 c2c2 c1c1 p1p1 p2p2 c1c1 c2c2 p1p1 p2p2 c1c1 c2c2

Run-Time Monitoring and Feedback  Never adds new interleavings, but may cause deadlock  Choice of two run-time deadlock detectors 1. High-overhead, immediate notification  Must monitor all synchronization operations at all times  Always knows complete resource-allocation graph 2. Low-overhead, delayed notification  Does nothing until after a lock timeout  Eventually infers resource-allocation graph, then checks for cycles  If bug detector is incomplete, reapply to patched program  May report additional (p, c, r) pairs, requiring further patching  Done fixing when bug detector can no longer find problems

Evaluation: Overall Patch Quality BugNaïveUnmergedMergedManual Apache-- MySQL 1-  MySQL 2-  Mozilla 1-  Mozilla 2- Cherokee- FFT--  PBZIP2---  Patched failure rates: 0% (except PBZIP2 and FFT)  Patched overheads: <0.6% (except PBZIP2)  Readily understandable, with few mutexes after merging

Evaluation: Failure Rate Under Testing BugOriginalNaïveUnmergedMerged Apache85%deadlock83%0% MySQL 141%deadlock0% MySQL 253%deadlock0% Mozilla 141%deadlock0% Mozilla 248%deadlock0% Cherokee81%deadlock0% FFT74%73%87%30% PBZIP294%deadlock66%20%  Patched failure rates: 0% (except PBZIP2 and FFT)  Patched overheads: <0.6% (except PBZIP2)  Readily understandable, with few mutexes after merging

Evaluation: Performance Overhead BugNaïveUnmergedMergedManual Apache-0.45%-0.97%-0.26% MySQL % 0.45% MySQL % 1.02% Mozilla %0.55%0.12% Mozilla % -0.20% Cherokee--1.02%-1.04%0.39% FFT-0.02%-0.07%-0.02%0.19% PBZIP2-89,132%181.82%-0.20%  Patched failure rates: 0% (except PBZIP2 and FFT)  Patched overheads: <0.6% (except PBZIP2)  Readily understandable, with few mutexes after merging

Conclusions  Patient says, “Doctor, doctor, it hurts when I do this.”  Doctor replies, “Then don’t do that!” ☺  Natural to apply this to concurrency  But must be exceedingly careful in the details  Makes strong guarantees, but does not promise the world  Never allows interleavings that were not already possible  But may cause deadlocks by over-constraining execution space  Uses some heuristics, but excellent results in practice  Overheads too low to reliably measure  Produces small, simple, understandable patches  Completely eliminates detected bugs in targeted class

Abstract Fixing software bugs has always been an important and time-consuming process in software development. Fixing concurrency bugs has become especially critical in the multicore era. However, fixing concurrency bugs is challenging, in part due to non-deterministic failures and tricky parallel reasoning. Beyond correctly fixing the original problem in the software, a good patch should also avoid introducing new bugs, degrading performance unnecessarily, or damaging software readability. Existing tools cannot automate the whole fixing process and provide good-quality patches. I will present AFix, a tool that automates the whole process of fixing one common type of concurrency bug: single-variable atomicity violations. AFix starts from the bug reports of existing bug-detection tools. It augments these with static analysis to construct a suitable patch for each bug report. It further tries to combine the patches of multiple bugs for better performance and code readability. Finally, AFix's run-time component provides testing customized for each patch. Experimental evaluation shows that patches automatically generated by AFix correctly eliminate six out of eight real-world bugs and significantly decrease the failure probability in the other two cases. AFix patches never introduce new bugs and have similar performance to manually-designed patches.