A Classification of Concurrency Bugs in Java Benchmarks by Developer Intent

Size: px
Start display at page:

Download "A Classification of Concurrency Bugs in Java Benchmarks by Developer Intent"

Transcription

1 A Classification of Concurrency Bugs in Java Benchmarks by Developer Intent M. Erkan Keremoglu, Serdar Tasiran, Tayfun Elmas Center for Advanced Design Koc University Koç University, Istanbul, Turkey 1

2 Introduction and Objective - Correctness Criteria For Concurrent Software: - Race freedom: Reads and writes totally ordered by synchronization operations. - Atomicity: No interference between a code block and other threads. - Refinement: Concurrent execution consistent with its sequential specification. - Should pick correctness criterion that best expresses designer s intent - Wrong choice of criterion Only bug symptom treated Wrong fix: Bug remains, performance gets worse,... - We illustrate our point using Apache FTP Server concurrency bug from Mayur Naik, Alex Aiken, and John Whaley. Effective Static Race Detection for Java. ACM SIGPLAN 2006 Conf. on Programming Language Design and Implementation (PLDI 2006), Ottawa, Canada, June

3 APACHE FTP SERVER CONNECTION HANDLING public void run() { INITIALIZE 2... THE CONNECTION 3 dereference m_request, m_writer, m_reader while(connection 4 and m_controlsocket is alive){ to initialize the connection 5... READ NEXT REQUEST 6 while(!m_isconnectionclosed){ 7 String commandline = m_reader.readline(); 8 PERFORM if(commandline REQUESTED == null) ACTION { (USING 9 REQUEST HANDLER S FIELDS) commandline = commandline.trim(); 12 if(commandline.equals("")) { 13 continue; m_request.parse(commandline); 16 if(!haspermission()) { 17 m_writer.send(530, "permission", null); 18 continue; // execute command 21 service(m_request, m_writer); 22 public void close() { CLOSE CONNECTION 2 // check whether already closed //or not 3 CLEAR synchronized(this) FIELDS (SET { FIELDS 4 TO NULL) 5 return; 6 m_isconnectionclosed = true; m_request = null; 10 m_writer = null; 11 m_reader = null; 12 m_controlsocket = null;... These fields are shared Shared Fields 3

4 Connection thread BUG MANIFESTATION Close Thread public void run() { public void close() { // check whether already closed 3 dereference m_request, m_writer, m_reader //or not 4 and m_controlsocket to initialize the connection 3 synchronized(this) { Detects that 5 return; 6 while(!m_isconnectionclosed){ connection is alive 6 m_isconnectionclosed = true; String commandline = m_reader.readline(); 8 if(commandline == null) { commandline = commandline.trim(); 12 if(commandline.equals("")) { 13 continue; m_request.parse(commandline); 16 if(!haspermission()) { 17 m_writer.send(530, "permission", null); 18 continue; // execute command 21 service(m_request, m_writer); 22 9 m_request = null; 10 m_writer = null; 11 m_reader = null; 12 m_controlsocket = null;... Null Pointer Exception 4

5 public void run() { public void close() { dereference m_request, m_writer, m_reader 4 and m_controlsocket to initialize the connection while(!m_isconnectionclosed){ 7 String commandline = m_reader.readline(); 8 if(commandline == null) { commandline = commandline.trim(); 12 if(commandline.equals("")) { 13 continue; m_request.parse(commandline); 16 if(!haspermission()) { 17 m_writer.send(530, "permission", null); 18 continue; // execute command 21 service(m_request, m_writer); 22 2 // check whether already closed //or not 3 synchronized(this) { 4 5 return; 6 m_isconnectionclosed = true; m_request = null; 10 m_writer = null; 11 m_reader = null; 12 m_controlsocket = null;... Make m_reader, m_request,... volatile All races dissappear, but bug remains! Null Pointer Exception still there! 5

6 public void run() { synchronized(this) dereference m_request, { m_writer, m_reader 4 and init(); m_controlsocket to initialize the connection while(!m_isconnectionclosed){ 7 String commandline = m_reader.readline(); 8 if(commandline == null) { commandline = commandline.trim(); 12 if(commandline.equals("")) { 13 continue; m_request.parse(commandline); 16 if(!haspermission()) { 17 m_writer.send(530, "permission", null); 18 continue; // execute command 21 service(m_request, m_writer); 22 Solution 12 while(!m_isconnectionclosed) 2 synchronized(this) { { synchronized(this) synchronized(this) 3 init(); { { 4 else else cline cline = m_reader.readline(); m_reader.readline(); if(commandline == null) { synchronized(this) { cline = cline.trim(); if(commandline.equals("")) else{ { continue; m_request.parse(cline); if(!haspermission()) { m_request.parse(cline); m_writer.send(530); if(!haspermission()) continue; { m_writer.send(530); service(m_request, continue; m_writer); service(m_request, m_writer); 6

7 Solution 1 while(!m_isconnectionclosed) { synchronized(this) { else cline = m_reader.readline(); if(commandline == null) { cline = cline.trim(); if(commandline.equals("")) { continue; m_request.parse(cline); if(!haspermission()) { m_writer.send(530); continue; service(m_request, m_writer); Solution 2 synchronized(this) { else cline = m_reader.readline(); synchronized(this) { else{ m_request.parse(cline); if(!haspermission()) { m_writer.send(530); continue; service(m_request, m_writer); To fix concurrency bug, select criterion that best reflects developer s intent 7

8 Ongoing Work Building higher-level concurrency bug benchmarks from practically used software. VYRD+ - Race + Atomicity + Refinement Checker T. Elmas,, S. Tasiran,, and S. Qadeer [PLDI 05] Vyrd: : Verifying Concurrent Programs by Runtime Refinement-Violationiolation Detection. Location Pairs Coverage Metric - Investigating correspondence to concurrency errors. - Building coverage measurement tool. S.Tasiran,, T. Elmas,, G. Bolukbasi,, M. E. Keremoglu [FATES 05] A Novel Test Coverage Metric for Concurrently-Accessed Software Components. 8

9 9

A Causality-Based Runtime Check for (Rollback) Atomicity

A Causality-Based Runtime Check for (Rollback) Atomicity A Causality-Based Runtime Check for (Rollback) Atomicity Serdar Tasiran Koc University Istanbul, Turkey Tayfun Elmas Koc University Istanbul, Turkey RV 2007 March 13, 2007 Outline This paper: Define rollback

More information

VyrdMC: Driving Runtime Refinement Checking with Model Checkers

VyrdMC: Driving Runtime Refinement Checking with Model Checkers Electronic Notes in Theoretical Computer Science 144 (2006) 41 56 www.elsevier.com/locate/entcs VyrdMC: Driving Runtime Refinement Checking with Model Checkers Tayfun Elmas 1 Serdar Tasiran 2 College of

More information

CalFuzzer: An Extensible Active Testing Framework for Concurrent Programs Pallavi Joshi 1, Mayur Naik 2, Chang-Seo Park 1, and Koushik Sen 1

CalFuzzer: An Extensible Active Testing Framework for Concurrent Programs Pallavi Joshi 1, Mayur Naik 2, Chang-Seo Park 1, and Koushik Sen 1 CalFuzzer: An Extensible Active Testing Framework for Concurrent Programs Pallavi Joshi 1, Mayur Naik 2, Chang-Seo Park 1, and Koushik Sen 1 1 University of California, Berkeley, USA {pallavi,parkcs,ksen}@eecs.berkeley.edu

More information

Part 3: Beyond Reduction

Part 3: Beyond Reduction Lightweight Analyses For Reliable Concurrency Part 3: Beyond Reduction Stephen Freund Williams College joint work with Cormac Flanagan (UCSC), Shaz Qadeer (MSR) Busy Acquire Busy Acquire void busy_acquire()

More information

Hybrid Static-Dynamic Analysis for Statically Bounded Region Serializability

Hybrid Static-Dynamic Analysis for Statically Bounded Region Serializability Hybrid Static-Dynamic Analysis for Statically Bounded Region Serializability Aritra Sengupta, Swarnendu Biswas, Minjia Zhang, Michael D. Bond and Milind Kulkarni ASPLOS 2015, ISTANBUL, TURKEY Programming

More information

DoubleChecker: Efficient Sound and Precise Atomicity Checking

DoubleChecker: Efficient Sound and Precise Atomicity Checking DoubleChecker: Efficient Sound and Precise Atomicity Checking Swarnendu Biswas, Jipeng Huang, Aritra Sengupta, and Michael D. Bond The Ohio State University PLDI 2014 Impact of Concurrency Bugs Impact

More information

Static Analysis of Embedded C Code

Static Analysis of Embedded C Code Static Analysis of Embedded C Code John Regehr University of Utah Joint work with Nathan Cooprider Relevant features of C code for MCUs Interrupt-driven concurrency Direct hardware access Whole program

More information

Active Testing for Concurrent Programs

Active Testing for Concurrent Programs Active Testing for Concurrent Programs Pallavi Joshi Mayur Naik Chang-Seo Park Koushik Sen 1/8/2009 ParLab Retreat ParLab, UC Berkeley Intel Research Overview Checking correctness of concurrent programs

More information

11/19/2013. Imperative programs

11/19/2013. Imperative programs if (flag) 1 2 From my perspective, parallelism is the biggest challenge since high level programming languages. It s the biggest thing in 50 years because industry is betting its future that parallel programming

More information

Active Testing for Concurrent Programs

Active Testing for Concurrent Programs Active Testing for Concurrent Programs Pallavi Joshi, Mayur Naik, Chang-Seo Park, Koushik Sen 12/30/2008 ROPAS Seminar ParLab, UC Berkeley Intel Research Overview ParLab The Parallel Computing Laboratory

More information

The Java Memory Model

The Java Memory Model The Java Memory Model The meaning of concurrency in Java Bartosz Milewski Plan of the talk Motivating example Sequential consistency Data races The DRF guarantee Causality Out-of-thin-air guarantee Implementation

More information

Runtime Refinement Checking of Concurrent Data Structures

Runtime Refinement Checking of Concurrent Data Structures Electronic Notes in Theoretical Computer Science 113 (2005) 163 179 www.elsevier.com/locate/entcs Runtime Refinement Checking of Concurrent Data Structures Serdar Tasiran Koç University, Istanbul, Turkey

More information

Static Analysis of Embedded C

Static Analysis of Embedded C Static Analysis of Embedded C John Regehr University of Utah Joint work with Nathan Cooprider Motivating Platform: TinyOS Embedded software for wireless sensor network nodes Has lots of SW components for

More information

Types for Precise Thread Interference

Types for Precise Thread Interference Types for Precise Thread Interference Jaeheon Yi, Tim Disney, Cormac Flanagan UC Santa Cruz Stephen Freund Williams College October 23, 2011 2 Multiple Threads Single Thread is a non-atomic read-modify-write

More information

Yuxi Chen, Shu Wang, Shan Lu, and Karthikeyan Sankaralingam *

Yuxi Chen, Shu Wang, Shan Lu, and Karthikeyan Sankaralingam * Yuxi Chen, Shu Wang, Shan Lu, and Karthikeyan Sankaralingam * * 2 q Synchronization mistakes in multithreaded programs Thread 1 Thread 2 If(ptr){ tmp = *ptr; ptr = NULL; } Segfault q Common q Hard to diagnose

More information

Using Model Checking with Symbolic Execution to Verify Parallel Numerical Programs

Using Model Checking with Symbolic Execution to Verify Parallel Numerical Programs Using Model Checking with Symbolic Execution to Verify Parallel Numerical Programs Stephen F. Siegel 1 Anastasia Mironova 2 George S. Avrunin 1 Lori A. Clarke 1 1 University of Massachusetts Amherst 2

More information

C. Flanagan Dynamic Analysis for Atomicity 1

C. Flanagan Dynamic Analysis for Atomicity 1 1 Atomicity The method inc() is atomic if concurrent threads do not interfere with its behavior Guarantees that for every execution acq(this) x t=i y i=t+1 z rel(this) acq(this) x y t=i i=t+1 z rel(this)

More information

Statistical Debugging for Real-World Performance Problems

Statistical Debugging for Real-World Performance Problems Statistical Debugging for Real-World Performance Problems Linhai Song 1 and Shan Lu 2 1 University of Wisconsin-Madison 2 University of Chicago What are Performance Problems? Definition of Performance

More information

A Serializability Violation Detector for Shared-Memory Server Programs

A Serializability Violation Detector for Shared-Memory Server Programs A Serializability Violation Detector for Shared-Memory Server Programs Min Xu Rastislav Bodík Mark Hill University of Wisconsin Madison University of California, Berkeley Serializability Violation Detector:

More information

Atomicity. Experience with Calvin. Tools for Checking Atomicity. Tools for Checking Atomicity. Tools for Checking Atomicity

Atomicity. Experience with Calvin. Tools for Checking Atomicity. Tools for Checking Atomicity. Tools for Checking Atomicity 1 2 Atomicity The method inc() is atomic if concurrent ths do not interfere with its behavior Guarantees that for every execution acq(this) x t=i y i=t+1 z rel(this) acq(this) x y t=i i=t+1 z rel(this)

More information

BERKELEY PAR LAB. UPC-THRILLE Demo. Chang-Seo Park

BERKELEY PAR LAB. UPC-THRILLE Demo. Chang-Seo Park BERKELEY PAR LAB UPC-THRILLE Demo Chang-Seo Park 1 Correctness Group Highlights Active Testing for Java, C, and UPC Practical, easy-to-use tools for finding bugs, with sophisticated program analysis internally

More information

Motivation & examples Threads, shared memory, & synchronization

Motivation & examples Threads, shared memory, & synchronization 1 Motivation & examples Threads, shared memory, & synchronization How do locks work? Data races (a lower level property) How do data race detectors work? Atomicity (a higher level property) Concurrency

More information

Toward Efficient Strong Memory Model Support for the Java Platform via Hybrid Synchronization

Toward Efficient Strong Memory Model Support for the Java Platform via Hybrid Synchronization Toward Efficient Strong Memory Model Support for the Java Platform via Hybrid Synchronization Aritra Sengupta, Man Cao, Michael D. Bond and Milind Kulkarni 1 PPPJ 2015, Melbourne, Florida, USA Programming

More information

The Java Memory Model

The Java Memory Model Jeremy Manson 1, William Pugh 1, and Sarita Adve 2 1 University of Maryland 2 University of Illinois at Urbana-Champaign Presented by John Fisher-Ogden November 22, 2005 Outline Introduction Sequential

More information

Synchronization. Announcements. Concurrent Programs. Race Conditions. Race Conditions 11/9/17. Purpose of this lecture. A8 released today, Due: 11/21

Synchronization. Announcements. Concurrent Programs. Race Conditions. Race Conditions 11/9/17. Purpose of this lecture. A8 released today, Due: 11/21 Announcements Synchronization A8 released today, Due: 11/21 Late deadline is after Thanksgiving You can use your A6/A7 solutions or ours A7 correctness scores have been posted Next week's recitation will

More information

Functional Programming and Parallel Computing

Functional Programming and Parallel Computing Functional Programming and Parallel Computing Björn Lisper School of Innovation, Design, and Engineering Mälardalen University bjorn.lisper@mdh.se http://www.idt.mdh.se/ blr/ Functional Programming and

More information

Static and Dynamic Program Analysis: Synergies and Applications

Static and Dynamic Program Analysis: Synergies and Applications Static and Dynamic Program Analysis: Synergies and Applications Mayur Naik Intel Labs, Berkeley CS 243, Stanford University March 9, 2011 Today s Computing Platforms Trends: parallel cloud mobile Traits:

More information

Concurrency. Johan Montelius KTH

Concurrency. Johan Montelius KTH Concurrency Johan Montelius KTH 2017 1 / 32 What is concurrency? 2 / 32 What is concurrency? Concurrency: (the illusion of) happening at the same time. 2 / 32 What is concurrency? Concurrency: (the illusion

More information

Formal Verification Techniques for GPU Kernels Lecture 1

Formal Verification Techniques for GPU Kernels Lecture 1 École de Recherche: Semantics and Tools for Low-Level Concurrent Programming ENS Lyon Formal Verification Techniques for GPU Kernels Lecture 1 Alastair Donaldson Imperial College London www.doc.ic.ac.uk/~afd

More information

Cooperari A tool for cooperative testing of multithreaded Java programs

Cooperari A tool for cooperative testing of multithreaded Java programs Cooperari A tool for cooperative testing of multithreaded Java programs Eduardo R. B. Marques, Francisco Martins, Miguel Simões! LASIGE/Departamento de Informática Faculdade de Ciências da Universidade

More information

What is concurrency? Concurrency. What is parallelism? concurrency vs parallelism. Concurrency: (the illusion of) happening at the same time.

What is concurrency? Concurrency. What is parallelism? concurrency vs parallelism. Concurrency: (the illusion of) happening at the same time. What is concurrency? Concurrency Johan Montelius KTH 2017 Concurrency: (the illusion of) happening at the same time. A property of the programing model. Why would we want to do things concurrently? What

More information

Evolving HPCToolkit John Mellor-Crummey Department of Computer Science Rice University Scalable Tools Workshop 7 August 2017

Evolving HPCToolkit John Mellor-Crummey Department of Computer Science Rice University   Scalable Tools Workshop 7 August 2017 Evolving HPCToolkit John Mellor-Crummey Department of Computer Science Rice University http://hpctoolkit.org Scalable Tools Workshop 7 August 2017 HPCToolkit 1 HPCToolkit Workflow source code compile &

More information

Coverage Metrics for Functional Validation of Hardware Designs

Coverage Metrics for Functional Validation of Hardware Designs Coverage Metrics for Functional Validation of Hardware Designs Serdar Tasiran, Kurt Keutzer IEEE, Design & Test of Computers,2001 Presenter Guang-Pau Lin What s the problem? What can ensure optimal use

More information

Synchronizing the Asynchronous

Synchronizing the Asynchronous Synchronizing the Asynchronous Bernhard Kragl IST Austria Shaz Qadeer Microsoft Thomas A. Henzinger IST Austria Concurrency is Ubiquitous Asynchronous Concurrency is Ubiquitous Asynchronous programs are

More information

Cooperative Concurrency for a Multicore World

Cooperative Concurrency for a Multicore World Cooperative Concurrency for a Multicore World Stephen Freund Williams College Cormac Flanagan, Tim Disney, Caitlin Sadowski, Jaeheon Yi, UC Santa Cruz Controlling Thread Interference: #1 Manually x = 0;

More information

Concurrency Assurance in Fluid

Concurrency Assurance in Fluid Concurrency Assurance in Fluid Related reading: Assuring and Evolving Concurrent Programs: Annotations and Policy 15-413: Introduction to Software Engineering Jonathan Aldrich Find the Concurrency Bug!

More information

Synchronization Lecture 23 Fall 2017

Synchronization Lecture 23 Fall 2017 Synchronization Lecture 23 Fall 2017 Announcements A8 released today, Due: 11/21 Late deadline is after Thanksgiving You can use your A6/A7 solutions or ours A7 correctness scores have been posted Next

More information

Threads Synchronization

Threads Synchronization Synchronization Threads Synchronization Threads share memory so communication can be based on shared references. This is a very effective way to communicate but is prone to two types of errors: Interference

More information

A Case for System Support for Concurrency Exceptions

A Case for System Support for Concurrency Exceptions A Case for System Support for Concurrency Exceptions Luis Ceze, Joseph Devietti, Brandon Lucia and Shaz Qadeer University of Washington {luisceze, devietti, blucia0a}@cs.washington.edu Microsoft Research

More information

AUTOMATICALLY INFERRING STRUCTURE CORRELATED VARIABLE SET FOR CONCURRENT ATOMICITY SAFETY

AUTOMATICALLY INFERRING STRUCTURE CORRELATED VARIABLE SET FOR CONCURRENT ATOMICITY SAFETY AUTOMATICALLY INFERRING STRUCTURE CORRELATED VARIABLE SET FOR CONCURRENT ATOMICITY SAFETY Long Pang 1, Xiaohong Su 2, Peijun Ma 3 and Lingling Zhao 4 School of Computer Science and Technology, Harbin Institute

More information

7/6/2015. Motivation & examples Threads, shared memory, & synchronization. Imperative programs

7/6/2015. Motivation & examples Threads, shared memory, & synchronization. Imperative programs Motivation & examples Threads, shared memory, & synchronization How do locks work? Data races (a lower level property) How do data race detectors work? Atomicity (a higher level property) Concurrency exceptions

More information

Atomicity CS 2110 Fall 2017

Atomicity CS 2110 Fall 2017 Atomicity CS 2110 Fall 2017 Parallel Programming Thus Far Parallel programs can be faster and more efficient Problem: race conditions Solution: synchronization Are there more efficient ways to ensure the

More information

Static program checking and verification

Static program checking and verification Chair of Software Engineering Software Engineering Prof. Dr. Bertrand Meyer March 2007 June 2007 Slides: Based on KSE06 With kind permission of Peter Müller Static program checking and verification Correctness

More information

Race Directed Random Testing of Concurrent Programs

Race Directed Random Testing of Concurrent Programs Race Directed Random Testing of Concurrent Programs Koushik Sen EECS Department, UC Berkeley, CA, USA. ksen@cs.berkeley.edu Abstract Bugs in multi-threaded programs often arise due to data races. Numerous

More information

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (II)

SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (II) SSC - Concurrency and Multi-threading Java multithreading programming - Synchronisation (II) Shan He School for Computational Science University of Birmingham Module 06-19321: SSC Outline Outline of Topics

More information

Understandable Concurrency

Understandable Concurrency Edward A. Lee Professor, Chair of EE, and Associate Chair of EECS Director, CHESS: Center for Hybrid and Embedded Software Systems Director, Ptolemy Project UC Berkeley Chess Review November 21, 2005 Berkeley,

More information

Synchronization SPL/2010 SPL/20 1

Synchronization SPL/2010 SPL/20 1 Synchronization 1 Overview synchronization mechanisms in modern RTEs concurrency issues places where synchronization is needed structural ways (design patterns) for exclusive access 2 Overview synchronization

More information

The Quest for Precision: A Layered Approach for Data Race Detection in Static Analysis

The Quest for Precision: A Layered Approach for Data Race Detection in Static Analysis The Quest for Precision: A Layered Approach for Data Race Detection in Static Analysis Jakob Mund 1?, Ralf Huuck 2, Ansgar Fehnker 2,3, and Cyrille Artho 4 1 Technische Universität München, Munich, Germany

More information

Introduction to Threads

Introduction to Threads Computer Systems Introduction to Threads Race Conditions Single- vs. Multi-Threaded Processes Process Process Thread Thread Thread Thread Memory Memory Heap Stack Heap Stack Stack Stack Data Data Code

More information

Sharing is the Key. Lecture 25: Parallelism. Canonical Example. Bad Interleavings. Common to have: CS 62 Fall 2016 Kim Bruce & Peter Mawhorter

Sharing is the Key. Lecture 25: Parallelism. Canonical Example. Bad Interleavings. Common to have: CS 62 Fall 2016 Kim Bruce & Peter Mawhorter Sharing is the Key Lecture 25: Parallelism CS 62 Fall 2016 Kim Bruce & Peter Mawhorter Some slides based on those from Dan Grossman, U. of Washington Common to have: Different threads access the same resources

More information

Grand Central Dispatch. Sri Teja Basava CSCI 5528: Foundations of Software Engineering Spring 10

Grand Central Dispatch. Sri Teja Basava CSCI 5528: Foundations of Software Engineering Spring 10 Grand Central Dispatch Sri Teja Basava CSCI 5528: Foundations of Software Engineering Spring 10 1 New Technologies in Snow Leopard 2 Grand Central Dispatch An Apple technology to optimize application support

More information

Advanced MEIC. (Lesson #18)

Advanced MEIC. (Lesson #18) Advanced Programming @ MEIC (Lesson #18) Last class Data races Java Memory Model No out-of-thin-air values Data-race free programs behave as expected Today Finish with the Java Memory Model Introduction

More information

Software Architecture and Engineering: Part II

Software Architecture and Engineering: Part II Software Architecture and Engineering: Part II ETH Zurich, Spring 2016 Prof. http://www.srl.inf.ethz.ch/ Framework SMT solver Alias Analysis Relational Analysis Assertions Second Project Static Analysis

More information

SCALABLE STATISTICAL BUG ISOLATION

SCALABLE STATISTICAL BUG ISOLATION SCALABLE STATISTICAL BUG ISOLATION Paper by Ben Liblit, Mayur Naik, Alice X. Zheng, Alex Aiken, Michael I. Jordan Presented by Ben Mishkanian 2/5/2015 Statistical Debugging Idea: Use dynamic statistical

More information

Hierarchical Pointer Analysis for Distributed Programs

Hierarchical Pointer Analysis for Distributed Programs Hierarchical Pointer Analysis for Distributed Programs Amir Kamil Computer Science Division, University of California, Berkeley kamil@cs.berkeley.edu April 14, 2006 1 Introduction Many distributed, parallel

More information

Introducing Shared-Memory Concurrency

Introducing Shared-Memory Concurrency Race Conditions and Atomic Blocks November 19, 2007 Why use concurrency? Communicating between threads Concurrency in Java/C Concurrency Computation where multiple things happen at the same time is inherently

More information

Introduction to Locks. Intrinsic Locks

Introduction to Locks. Intrinsic Locks CMSC 433 Programming Language Technologies and Paradigms Spring 2013 Introduction to Locks Intrinsic Locks Atomic-looking operations Resources created for sequential code make certain assumptions, a large

More information

Learning from Bad Examples. CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014

Learning from Bad Examples. CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014 Learning from Bad Examples CSCI 5828: Foundations of Software Engineering Lecture 25 11/18/2014 1 Goals Demonstrate techniques to design for shared mutability Build on an example where multiple threads

More information

Verifying Concurrent Programs

Verifying Concurrent Programs Verifying Concurrent Programs Daniel Kroening 8 May 1 June 01 Outline Shared-Variable Concurrency Predicate Abstraction for Concurrent Programs Boolean Programs with Bounded Replication Boolean Programs

More information

Automatically Repairing Concurrency Bugs with ARC MUSEPAT 2013 Saint Petersburg, Russia

Automatically Repairing Concurrency Bugs with ARC MUSEPAT 2013 Saint Petersburg, Russia Automatically Repairing Concurrency Bugs with ARC MUSEPAT 2013 Saint Petersburg, Russia David Kelk, Kevin Jalbert, Jeremy S. Bradbury Faculty of Science (Computer Science) University of Ontario Institute

More information

Learning Loop Invariants for Program Verification

Learning Loop Invariants for Program Verification Learning Loop Invariants for Program Verification Xujie Si*, Hanjun Dai*, Mukund Raghothaman, Mayur Naik, Le Song University of Pennsylvania Georgia Institute of Technology NeurIPS 2018 Code: https://github.com/pl-ml/code2inv

More information

NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness

NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness EECS Electrical Engineering and Computer Sciences P A R A L L E L C O M P U T I N G L A B O R A T O R Y NDSeq: Runtime Checking for Nondeterministic Sequential Specs of Parallel Correctness Jacob Burnim,

More information

Runtime Atomicity Analysis of Multi-threaded Programs

Runtime Atomicity Analysis of Multi-threaded Programs Runtime Atomicity Analysis of Multi-threaded Programs Focus is on the paper: Atomizer: A Dynamic Atomicity Checker for Multithreaded Programs by C. Flanagan and S. Freund presented by Sebastian Burckhardt

More information

CSE332: Data Abstractions Lecture 25: Deadlocks and Additional Concurrency Issues. Tyler Robison Summer 2010

CSE332: Data Abstractions Lecture 25: Deadlocks and Additional Concurrency Issues. Tyler Robison Summer 2010 CSE332: Data Abstractions Lecture 25: Deadlocks and Additional Concurrency Issues Tyler Robison Summer 2010 1 Where we are We ve covered basic concurrency, then some odds and ends: Readers/writer locks

More information

CSE 374 Programming Concepts & Tools

CSE 374 Programming Concepts & Tools CSE 374 Programming Concepts & Tools Hal Perkins Fall 2017 Lecture 22 Shared-Memory Concurrency 1 Administrivia HW7 due Thursday night, 11 pm (+ late days if you still have any & want to use them) Course

More information

Clash of the Titans: Tools and Techniques for Hunting Bugs in Concurrent Programs

Clash of the Titans: Tools and Techniques for Hunting Bugs in Concurrent Programs Clash of the Titans: Tools and Techniques for Hunting Bugs in Concurrent Programs ABSTRACT Neha Rungta Dept. of Computer Science Brigham Young University Provo, UT 84602, USA neha@cs.byu.edu In this work

More information

FastTrack: Efficient and Precise Dynamic Race Detection By Cormac Flanagan and Stephen N. Freund

FastTrack: Efficient and Precise Dynamic Race Detection By Cormac Flanagan and Stephen N. Freund FastTrack: Efficient and Precise Dynamic Race Detection By Cormac Flanagan and Stephen N. Freund doi:10.1145/1839676.1839699 Abstract Multithreaded programs are notoriously prone to race conditions. Prior

More information

Semantic Atomicity for Multithreaded Programs!

Semantic Atomicity for Multithreaded Programs! P A R A L L E L C O M P U T I N G L A B O R A T O R Y Semantic Atomicity for Multithreaded Programs! Jacob Burnim, George Necula, Koushik Sen! Parallel Computing Laboratory! University of California, Berkeley!

More information

Combining the Logical and the Probabilistic in Program Analysis. Xin Zhang Xujie Si Mayur Naik University of Pennsylvania

Combining the Logical and the Probabilistic in Program Analysis. Xin Zhang Xujie Si Mayur Naik University of Pennsylvania Combining the Logical and the Probabilistic in Program Analysis Xin Zhang Xujie Si Mayur Naik University of Pennsylvania What is Program Analysis? int f(int i) {... } Program Analysis x may be null!...

More information

Leveraging the Short-Term Memory of Hardware to Diagnose Production-Run Software Failures. Joy Arulraj, Guoliang Jin and Shan Lu

Leveraging the Short-Term Memory of Hardware to Diagnose Production-Run Software Failures. Joy Arulraj, Guoliang Jin and Shan Lu Leveraging the Short-Term Memory of Hardware to Diagnose Production-Run Software Failures Joy Arulraj, Guoliang Jin and Shan Lu Production-Run Failure Diagnosis Goal Figure out root cause of failure on

More information

Topics on Compilers Spring Semester Christine Wagner 2011/04/13

Topics on Compilers Spring Semester Christine Wagner 2011/04/13 Topics on Compilers Spring Semester 2011 Christine Wagner 2011/04/13 Availability of multicore processors Parallelization of sequential programs for performance improvement Manual code parallelization:

More information

CHESS: Analysis and Testing of Concurrent Programs

CHESS: Analysis and Testing of Concurrent Programs CHESS: Analysis and Testing of Concurrent Programs Sebastian Burckhardt, Madan Musuvathi, Shaz Qadeer Microsoft Research Joint work with Tom Ball, Peli de Halleux, and interns Gerard Basler (ETH Zurich),

More information

GCC Developers Summit Ottawa, Canada, June 2006

GCC Developers Summit Ottawa, Canada, June 2006 OpenMP Implementation in GCC Diego Novillo dnovillo@redhat.com Red Hat Canada GCC Developers Summit Ottawa, Canada, June 2006 OpenMP Language extensions for shared memory concurrency (C, C++ and Fortran)

More information

CSC 1600: Chapter 6. Synchronizing Threads. Semaphores " Review: Multi-Threaded Processes"

CSC 1600: Chapter 6. Synchronizing Threads. Semaphores  Review: Multi-Threaded Processes CSC 1600: Chapter 6 Synchronizing Threads with Semaphores " Review: Multi-Threaded Processes" 1 badcnt.c: An Incorrect Program" #define NITERS 1000000 unsigned int cnt = 0; /* shared */ int main() pthread_t

More information

Effective Static Race Detection for Java. Part I. Chord. Chord. Chord. Chord - Overview. Problems addressed

Effective Static Race Detection for Java. Part I. Chord. Chord. Chord. Chord - Overview. Problems addressed Eective Static Race Detection or Java Mayer Naik, Alex Aiken, John Whaley Part I Introduction to Chord and Preliminaries presented by Matt McGill Chord Chord Chord is a static (data) race detection tool

More information

Rethinking Runtime Verification on Hundreds of Cores: Challenges and Opportunities

Rethinking Runtime Verification on Hundreds of Cores: Challenges and Opportunities Rethinking Runtime Verification on Hundreds of Cores: Challenges and Opportunities Tayfun Elmas Semih Okur Serdar Tasiran Electrical Engineering and Computer Sciences University of California at Berkeley

More information

Checking and Inferring Local Non-Aliasing. UC Berkeley UC Berkeley

Checking and Inferring Local Non-Aliasing. UC Berkeley UC Berkeley Checking and Inferring Local Non-Aliasing Alex Aiken UC Berkeley Jeffrey S. Foster UMD College Park John Kodumal Tachio Terauchi UC Berkeley UC Berkeley Introduction Aliasing: A long-standing problem Pointers

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

Static Detection of Atomicity Violations in Object-Oriented Programs

Static Detection of Atomicity Violations in Object-Oriented Programs Vol. 3, No. 2, March April 2004 Static Detection of Atomicity Violations in Object-Oriented Programs Christoph von Praun and Thomas Gross Laboratory for Software Technology, ETH Zurich, Switzerland Violations

More information

Automatic Testing of Sequential and Concurrent Substitutability

Automatic Testing of Sequential and Concurrent Substitutability Automatic Testing of Sequential and Concurrent Substitutability Michael Pradel and Thomas R. Gross Department of Computer Science ETH Zurich 1 Motivation void bar(foo f) { f.m();... } bar() expects functionality

More information

SOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE

SOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE Software Quality Objectives Page 1/21 Version 2.0 SOFTWARE QUALITY OBJECTIVES FOR SOURCE CODE The MathWorks 2 rue de Paris 92196 Meudon France 01 41 14 87 00 http://www.mathworks.fr Revision table Index

More information

Identifying Patch Correctness in Test-based Program Repair. Yingfei Xiong, Xinyuan Liu, Muhan Zeng, Lu Zhang, Gang Huang Peking University

Identifying Patch Correctness in Test-based Program Repair. Yingfei Xiong, Xinyuan Liu, Muhan Zeng, Lu Zhang, Gang Huang Peking University Identifying Patch Correctness in Test-based Program Repair Yingfei Xiong, Xinyuan Liu, Muhan Zeng, Lu Zhang, Gang Huang Peking University Test-based Program Repair Passing test Passing test Passing test

More information

Tom Ball Sebastian Burckhardt Madan Musuvathi Microsoft Research

Tom Ball Sebastian Burckhardt Madan Musuvathi Microsoft Research Tom Ball (tball@microsoft.com) Sebastian Burckhardt (sburckha@microsoft.com) Madan Musuvathi (madanm@microsoft.com) Microsoft Research P&C Parallelism Concurrency Performance Speedup Responsiveness Correctness

More information

Understanding the Interleaving Space Overlap across Inputs and So7ware Versions

Understanding the Interleaving Space Overlap across Inputs and So7ware Versions Understanding the Interleaving Space Overlap across Inputs and So7ware Versions Dongdong Deng, Wei Zhang, Borui Wang, Peisen Zhao, Shan Lu University of Wisconsin, Madison 1 Concurrency bug detec3on is

More information

RELIABLE SOFTWARE SYSTEMS

RELIABLE SOFTWARE SYSTEMS gh@jpl.nasa.gov RELIABLE SOFTWARE SYSTEMS +50 1969 2019 LM: less than 10K lines of code (C-equiv) (36K ROM, 2K RAM, 43Khz cycle) Altair: est. 10M lines of code (est. 1GB RAM, est. 1Ghz cycle) 3 orders

More information

SideTrack: Generalizing Dynamic Atomicity Analysis

SideTrack: Generalizing Dynamic Atomicity Analysis SideTrack: Generalizing Dynamic Atomicity Analysis Jaeheon Yi jaeheon@cs.ucsc.edu Caitlin Sadowski supertri@cs.ucsc.edu Computer Science Department University of California at Santa Cruz Santa Cruz, CA

More information

i219 Software Design Methodology 11. Software model checking Kazuhiro Ogata (JAIST) Outline of lecture

i219 Software Design Methodology 11. Software model checking Kazuhiro Ogata (JAIST) Outline of lecture i219 Software Design Methodology 11. Software model checking Kazuhiro Ogata (JAIST) Outline of lecture 2 Concurrency Model checking Java Pathfinder (JPF) Detecting race condition Bounded buffer problem

More information

Program Graph. Lecture 25: Parallelism & Concurrency. Performance. What does it mean?

Program Graph. Lecture 25: Parallelism & Concurrency. Performance. What does it mean? Program Graph Lecture 25: Parallelism & Concurrency CS 62 Fall 2015 Kim Bruce & Michael Bannister Some slides based on those from Dan Grossman, U. of Washington Program using fork and join can be seen

More information

1. Introduction to Concurrent Programming

1. Introduction to Concurrent Programming 1. Introduction to Concurrent Programming A concurrent program contains two or more threads that execute concurrently and work together to perform some task. When a program is executed, the operating system

More information

A Lightweight and Portable Approach to Making Concurrent Failures Reproducible

A Lightweight and Portable Approach to Making Concurrent Failures Reproducible A Lightweight and Portable Approach to Making Concurrent Failures Reproducible Qingzhou Luo 1, Sai Zhang 2, Jianjun Zhao 1, and Min Hu 1 1 School of Software, Shanghai Jiao Tong University {seriousam,

More information

Second assignment came out Monday evening. Find defects in Hnefetafl rules written by your classmates. Topic: Code Inspection and Testing

Second assignment came out Monday evening. Find defects in Hnefetafl rules written by your classmates. Topic: Code Inspection and Testing Announcements Second assignment came out Monday evening Topic: Code Inspection and Testing Find defects in Hnefetafl rules written by your classmates Compare inspection, coverage testing, random testing,

More information

A Parameterized Type System for Race-Free Java Programs

A Parameterized Type System for Race-Free Java Programs A Parameterized Type System for Race-Free Java Programs Chandrasekhar Boyapati Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology {chandra, rinard@lcs.mit.edu Data races

More information

Static and Precise Detection of Concurrency Errors in Systems Code Using SMT Solvers

Static and Precise Detection of Concurrency Errors in Systems Code Using SMT Solvers Static and Precise Detection of Concurrency Errors in Systems Code Using SMT Solvers Shuvendu K. Lahiri 1, Shaz Qadeer 1, and Zvonimir Rakamarić 2 1 Microsoft Research, Redmond, WA, USA {shuvendu,qadeer}@microsoft.com

More information

Combining the Logical and the Probabilistic in Program Analysis

Combining the Logical and the Probabilistic in Program Analysis Combining the Logical and the Probabilistic in Program Analysis Xin Zhang Georgia Institute of Technology, USA xin.zhang@gatech.edu Xujie Si University of Pennsylvania, USA xsi@cis.upenn.edu Mayur Naik

More information

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018

1 Introduction. 2 Managing contexts. Green, green threads of home. Johan Montelius HT2018 1 Introduction Green, green threads of home Johan Montelius HT2018 This is an assignment where you will implement your own thread library. Instead of using the operating systems threads you will create

More information

Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems)

Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems) Principles of Software Construction: Objects, Design, and Concurrency (Part 2: Designing (Sub )Systems) More Analysis for Functional Correctness Jonathan Aldrich Charlie Garrod School of Computer Science

More information

Atomicity via Source-to-Source Translation

Atomicity via Source-to-Source Translation Atomicity via Source-to-Source Translation Benjamin Hindman Dan Grossman University of Washington 22 October 2006 Atomic An easier-to-use and harder-to-implement primitive void deposit(int x){ synchronized(this){

More information

FULLY AUTOMATIC AND PRECISE DETECTION OF THREAD SAFETY VIOLATIONS

FULLY AUTOMATIC AND PRECISE DETECTION OF THREAD SAFETY VIOLATIONS FULLY AUTOMATIC AND PRECISE DETECTION OF THREAD SAFETY VIOLATIONS PLDI 2012 by Michael Pradel and Thomas R. Gross ETH Zurich presented by Martin Aigner University of Salzburg May 2, 2013 OVERVIEW The problem

More information

Predicting Null-Pointer Dereferences in Concurrent Programs. Parthasarathy Madhusudan Niloofar Razavi Francesco Sorrentino

Predicting Null-Pointer Dereferences in Concurrent Programs. Parthasarathy Madhusudan Niloofar Razavi Francesco Sorrentino Predicting Null-Pointer Dereferences in Concurrent Programs After work by: Azadeh Farzan Parthasarathy Madhusudan Niloofar Razavi Francesco Sorrentino Overview The problem The idea The solution The evaluation

More information