Efficient Model Checking of Data Races with Automatically-extracted Distance- based Fitness Functions João Paulo, Elton Alves, Marcelo Damorim, Fernando.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Advertisements

Effective Static Deadlock Detection
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.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: Process Synchronization
Background Concurrent access to shared data can lead to inconsistencies Maintaining data consistency among cooperating processes is critical What is wrong.
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
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.
Operating System Concepts and Techniques Lecture 12 Interprocess communication-1 M. Naghibzadeh Reference M. Naghibzadeh, Operating System Concepts and.
Mutual Exclusion.
Secure Operating Systems Lesson 5: Shared Objects.
© 2009 Matthew J. Sottile, Timothy G. Mattson, and Craig E Rasmussen 1 Concurrency in Programming Languages Matthew J. Sottile Timothy G. Mattson Craig.
Monitors Chapter 7. The semaphore is a low-level primitive because it is unstructured. If we were to build a large system using semaphores alone, the.
Atomicity in Multi-Threaded Programs Prachi Tiwari University of California, Santa Cruz CMPS 203 Programming Languages, Fall 2004.
C. FlanaganSAS’04: Type Inference Against Races1 Type Inference Against Races Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College.
Semaphores. Announcements No CS 415 Section this Friday Tom Roeder will hold office hours Homework 2 is due today.
Monitors CSCI 444/544 Operating Systems Fall 2008.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
02/11/2004CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
02/17/2010CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
02/14/2007CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
Synchronization CSCI 444/544 Operating Systems Fall 2008.
02/19/2007CSCI 315 Operating Systems Design1 Process Synchronization Notice: The slides for this lecture have been largely based on those accompanying.
Java How to Program, 9/e CET 3640 Professor: Dr. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
Threading in Java – a Tutorial QMUL IEEE SB. Why Threading When we need to run two tasks concurrently So multiple parts (>=2) of a program can run simultaneously.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
C. FlanaganType Systems for Multithreaded Software1 Cormac Flanagan UC Santa Cruz Stephen N. Freund Williams College Shaz Qadeer Microsoft Research.
The Critical Section Problem
111 © 2002, Cisco Systems, Inc. All rights reserved.
Java PathFinder (JPF) cs498dm Software Testing January 19, 2012.
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.
Verification of obstruction-free algorithm with contention management Niloufar Shafiei.
Chapter 7 -1 CHAPTER 7 PROCESS SYNCHRONIZATION CGS Operating System Concepts UCF, Spring 2004.
Dr. R R DOCSIT, Dr BAMU. Basic Java :Multi Threading Cont. 2 Objectives of This Session Explain Synchronization in threads Demonstrate use of.
1 Model Checking of Robotic Control Systems Presenting: Sebastian Scherer Authors: Sebastian Scherer, Flavio Lerda, and Edmund M. Clarke.
Debugging Threaded Applications By Andrew Binstock CMPS Parallel.
CAPP: Change-Aware Preemption Prioritization Vilas Jagannath, Qingzhou Luo, Darko Marinov Sep 6 th 2011.
Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois
CS 151: Object-Oriented Design November 26 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
Agenda  Quick Review  Finish Introduction  Java Threads.
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.
Software Design 13.1 From controller to threads l Threads are lightweight processes (what’s a process?)  Threads are part of a single program, share state.
Synchronization Questions answered in this lecture: Why is synchronization necessary? What are race conditions, critical sections, and atomic operations?
Process Synchronization. Concurrency Definition: Two or more processes execute concurrently when they execute different activities on different devices.
Healing Data Races On-The-Fly
Background on the need for Synchronization
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
Critical sections, locking, monitors, etc.
runtime verification Brief Overview Grigore Rosu
Specifying Multithreaded Java semantics for Program Verification
Definitions Concurrent program – Program that executes multiple instructions at the same time. Process – An executing program (the running JVM for Java.
Multithreaded Programming in Java
Threads and Memory Models Hal Perkins Autumn 2011
Monitors Chapter 7.
Atomicity in Multithreaded Software
Threads and Memory Models Hal Perkins Autumn 2009
Concurrency in Java Last Updated: Fall 2010 Paul Ammann SWE 619.
Lecture 2 Part 2 Process Synchronization
Background and Motivation
Monitors Chapter 7.
Concurrency: Mutual Exclusion and Process Synchronization
Monitors Chapter 7.
Chapter 6: Synchronization Tools
Problems with Locks Andrew Whitaker CSE451.
Process/Thread Synchronization (Part 2)
CSE 542: Operating Systems
CSE 542: Operating Systems
Threads CSE451 Andrew Whitaker TODO: print handouts for AspectRatio.
Presentation transcript:

Efficient Model Checking of Data Races with Automatically-extracted Distance- based Fitness Functions João Paulo, Elton Alves, Marcelo Damorim, Fernando Castor

Agenda Concurrent Programing Race Model Checking JPF Reade-Writers set – Algorithm Guiding Model Checking

Por que multi-núcleo? Antigamente, apenas aumentar o número de transistores era suficiente para aumento de desempenho Juntamente com o aumentos de cache E aumento da frequência de clock Hoje em dia, não é mais o caso Número de transistores continua crescendo Mas a frequência de clock está estagnada Consumo de energia e aquecimento são os fatores limitantes

Fonte:

Por que multi-núcleo (cont.)? Novas abordagens tornaram-se necessárias Solução encontrada: paralelismo Diversos núcleos em uma mesma pastilha Memória única Reaproveitamento de outros componentes Localidade propicia melhor desempenho Alternativa: diversos processadores Supercomputadores usam essa abordagem Mais cara

“The biggest sea change in software development since the OO revolution is knocking at the door, and its name is Concurrency”. Herb Sutter

Concurrent Programming Is too hard! – Error prone It’s difficult to debug and find errors Most programmers thinks that know how to do it, but they don’t NonDeterminism, Deadlocks, Data Races…

Race Condition public class Ref { int i; void inc() { int t = i + 1; i = t; } public static void main(String args[]){ final Ref ref = new Ref(); new Thread(new Runnable(){ public void run(){ ref.inc(); } }).start(); new Thread(new Runnable(){ public void run(){ ref.inc(); } }).start(); assert ref.i == 2; } A race condition occurs if two threads access a shared variable at the same time without synchronization at least one of those accesses is a write

public class Ref { int i; void inc() { synchronized (this) { int t = i + 1; i = t; } public static void main(String args[]) { final Ref ref = new Ref(); new Thread(new Runnable() { public void run() { ref.inc(); } }).start(); new Thread(new Runnable() { public void run() { ref.inc(); } }).start(); assert ref.i == 2; } Field Guarded by Lock Lock acquired before the thread enter in block Ensure race freedom Guarantees the mutual exclusion

Model Checking

Program Model Checking It performs model checking directly into the code Rigorous method that exhaustively explores all possible SUT behaviors Is it a test?

Model Checking Fonte:

Java PathFinder(JPF) An explicit state software model checker – Focus is on finding bugs in Java programs – Developed by NASA since 1999 – Turned Open Source in 2005 State Explosion problem

State Explosion # thread#Atomic Section Scheduling

How JPF Works Backtracking State Matching Partial Order Reduction Listener

How do Detect Races?

How do we Detect Potencial Races? Using a customized JPF listener For each PUTFIELD or GETFIELD – Get Object Reference Get the accessed Field – Get Current Thread » Get Current Instruction Get the set of Acquireds Locks

How do we Detect Potencial Races?[2] So, we have a report like this:

How do we Detect Potencial Races?[3] which can be simplified for this

How good is our solution?

Our Research Idea Guide Model Checking Attempt to Avoid State explosion Uses heuristics to classifies a given a state – Interesting State has value 0 – Boring State has value Integer.Max Uses distance based fitness function

Our work-in-progress Find a heuristic function to guide the Model Checking Evaluate the function This is harder than we thought 

Our work-in-progress[2] CallTrace cg; /* computed on-the-fly */ AccessPair[] goals; /* computed on-the-fly */ MethodInfo driver; /* test driver */ int eval(State jpfState) { ThreadInfo[] tis = jpfState.threadInfos(); TraceInfo ti = cg.getTrace(); for(int i=0; i<tis.length; i++) { MethodInfo ma = tis[j].getCurrentMethod(); foreach p:Pair in goals { int d = dist(ti, p.mx) * dist(ti, p.my); if (d < min) min = d; } } return min; } int dist(TraceInfo tSource, MethodInfo mDest) { int result = shortestPath(cg, tSource, mDest); if (result == -1) { // mDest not reachable from mSource return shortestPathFromDriver(cg, driver, mSource, mDest); }

If we are not so good to do it… The research goal could moves to compare the ‘potencial data race’ finded with other approaches 