CSE 788.07, Autumn 2011 Michael Bond.  Name  Program & year  Where are you coming from?  Research interests  Or what’s something you find interesting?

Slides:



Advertisements
Similar presentations
Dataflow Analysis for Datarace-Free Programs (ESOP 11) Arnab De Joint work with Deepak DSouza and Rupesh Nasre Indian Institute of Science, Bangalore.
Advertisements

Runtime Techniques for Efficient and Reliable Program Execution Harry Xu CS 295 Winter 2012.
Automatic Memory Management Noam Rinetzky Schreiber 123A /seminar/seminar1415a.html.
David Notkin Autumn 2009 CSE303 Lecture 13 This space for rent.
CS 162 Memory Consistency Models. Memory operations are reordered to improve performance Hardware (e.g., store buffer, reorder buffer) Compiler (e.g.,
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Chapter 6: 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.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Secure Operating Systems Lesson 5: Shared Objects.
Concurrency 101 Shared state. Part 1: General Concepts 2.
Background for “KISS: Keep It Simple and Sequential” cs264 Ras Bodik spring 2005.
CSE 341, Winter Type Systems Terms to learn about types: –Type –Type system –Statically typed language –Dynamically typed language –Type error –Strongly.
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.
S. Narayanasamy, Z. Wang, J. Tigani, A. Edwards, B. Calder UCSD and Microsoft PLDI 2007.
Recap from last time We saw various different issues related to program analysis and program transformations You were not expected to know all of these.
Programming Language Semantics Java Threads and Locks Informal Introduction The Java Specification Language Chapter 17.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
1 Sharing Objects – Ch. 3 Visibility What is the source of the issue? Volatile Dekker’s algorithm Publication and Escape Thread Confinement Immutability.
Cormac Flanagan UC Santa Cruz Velodrome: A Sound and Complete Dynamic Atomicity Checker for Multithreaded Programs Jaeheon Yi UC Santa Cruz Stephen Freund.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 15: More-Advanced Concepts.
Use of Coverity & Valgrind in Geant4 Gabriele Cosmo.
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.
Aritra Sengupta, Swarnendu Biswas, Minjia Zhang, Michael D. Bond and Milind Kulkarni ASPLOS 2015, ISTANBUL, TURKEY Hybrid Static-Dynamic Analysis for Statically.
Memory Consistency Models. Outline Review of multi-threaded program execution on uniprocessor Need for memory consistency models Sequential consistency.
Week 4 - Monday.  What did we talk about last time?  Queues  Implementing queues with circular arrays.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
Michael Bond Katherine Coons Kathryn McKinley University of Texas at Austin.
CS527 Topics in Software Engineering (Software Testing and Analysis) Darko Marinov August 30, 2011.
Threads and Singleton. Threads  The JVM allows multiple “threads of execution”  Essentially separate programs running concurrently in one memory space.
By: Rob von Behren, Jeremy Condit and Eric Brewer 2003 Presenter: Farnoosh MoshirFatemi Jan
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Semantic Analysis II Type Checking EECS 483 – Lecture 12 University of Michigan Wednesday, October 18, 2006.
CS12230 Introduction to Programming Lecture 6-2 –Errors and Exceptions 1.
CGS 3763 Operating Systems Concepts Spring 2013 Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM.
Week 9, Class 3: Java’s Happens-Before Memory Model (Slides used and skipped in class) SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors:
Today Quiz not yet graded Final report requirements posted More on Multithreading Happens-Before in Java SE-2811 Slide design: Dr. Mark L. Hornick Content:
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
Agenda  Quick Review  Finish Introduction  Java Threads.
Today Quiz not yet graded (Sorry!) More on Multithreading Happens-Before in Java Other langauges with Happens-Before Happens-Before in C++ SE-2811 Slide.
Testing Concurrent Programs Sri Teja Basava Arpit Sud CSCI 5535: Fundamentals of Programming Languages University of Colorado at Boulder Spring 2010.
Synchronization Questions answered in this lecture: Why is synchronization necessary? What are race conditions, critical sections, and atomic operations?
Healing Data Races On-The-Fly
Concurrency 2 CS 2110 – Spring 2016.
CSC 591/791 Reliable Software Systems
Memory Consistency Models
Seminar in automatic tools for analyzing programs with dynamic memory
Memory Consistency Models
Effective Data-Race Detection for the Kernel
Atomicity CS 2110 – Fall 2017.
Type Systems Terms to learn about types: Related concepts: Type
Threads and Memory Models Hal Perkins Autumn 2011
Monitors Chapter 7.
Threads and Memory Models Hal Perkins Autumn 2009
Monitors Chapter 7.
Monitors Chapter 7.
Type Systems Terms to learn: Type Type system
CSE 153 Design of Operating Systems Winter 19
Relaxed Consistency Part 2
Why we have Counterintuitive Memory Models
Compilers, Languages, and Memory Models
Foundations and Definitions
CS 8803: Memory Models David Devecsery.
Problems with Locks Andrew Whitaker CSE451.
Presentation transcript:

CSE , Autumn 2011 Michael Bond

 Name  Program & year  Where are you coming from?  Research interests  Or what’s something you find interesting?  Research advisor, if any

 Introductions  Motivation: concurrency correctness  Course overview & survey  Background  Program analysis

 Imperative programs  Java, C#, C, C++, Python, Ruby  Threads  Shared mutable state  Lock-unlock, wait-notify, start-join

 Atomicity  Ordering  Sequential consistency  Progress Programmers use synchronization to enforce these

More synchronizationLess synchronization More concurrencyLess concurrency

More synchronizationLess synchronization Concurrency bugs: atomicity, order, & sequential consistency violations Concurrency bugs: atomicity, order, & sequential consistency violations More concurrencyLess concurrency

More synchronizationLess synchronization Concurrency bugs: atomicity, order, & sequential consistency violations Concurrency bugs: atomicity, order, & sequential consistency violations More concurrency Concurrency bugs: deadlocks Poor performance: lock contention, serialization Less concurrency

More synchronizationLess synchronization Concurrency bugs: atomicity, order, & sequential consistency violations Concurrency bugs: atomicity, order, & sequential consistency violations More concurrency Concurrency bugs: deadlocks Poor performance: lock contention, serialization Concurrent & correct Less concurrency

* Definition for this research area Check or guarantee

Static analysisDynamic analysis Analyze static codeAnalyze running program Find errors in any executionFind errors in some real execution Sound: no false negatives*Unsound: false negatives Imprecise: false positivesPrecise: often no false positives Doesn’t slow running programSlows executing program

Static analysisDynamic analysis Analyze static codeAnalyze running program Find errors in any executionFind errors in some real execution Sound: no false negatives*Unsound: false negatives Imprecise: false positivesPrecise: often no false positives Doesn’t slow running programSlows executing program False positive: reported “bug” isn’t really a bug (declare correct program incorrect) False negative: miss a bug (declare incorrect program correct)

Static analysisDynamic analysis Analyze static codeAnalyze running program Find errors in any executionFind errors in some real execution Sound: no false negatives*Unsound: false negatives Imprecise: false positivesPrecise: often no false positives Doesn’t slow running programSlows executing program False positive: reported “bug” isn’t really a bug (declare correct program incorrect) False negative: miss a bug (declare incorrect program correct) Often dynamically sound: Reports all bugs in this execution Often dynamically sound: Reports all bugs in this execution

Static analysisDynamic analysis Analyze static codeAnalyze running program Find errors in any executionFind errors in some real execution Sound: no false negatives*Unsound: false negatives Imprecise: false positivesPrecise: often no false positives Doesn’t slow running programSlows executing program Conservative: 1.Concurrent execution 2.Approximating heap 3.Dynamic class loading & reflection Conservative: 1.Concurrent execution 2.Approximating heap 3.Dynamic class loading & reflection Most realistic executions are on deployed (production) systems!

1. Name (& nickname if applicable) 2. Program (PhD/master’s) & year (1 st, 2 nd, etc.) 3. Why taking class? 4. Research interests & current research advisor (if any) 5. Background (grad & undergrad): PL, compilers, architecture, parallel programming, runtime systems, SE 6. Available times on Mondays and Wednesdays 7. How likely you’ll stay in class (% or explain)? 8. Paper(s) you’d like to present (if any) 9. Feedback so far? 10. Concerns about forwarding critiques to all?

CSE , Autumn 2011 Michael Bond

Critiques  Critiques sent to everyone, but anonymous  Don’t write critique if leading discussion Discussion leaders  Covering in interactive way: paper’s main points, plus critical analysis & opportunities  Send scheduling 4 weekdays before class ▪ Full availability & current status/outline  Send outline: day before our meeting  Volunteer for next time?

Meeting  I/we need to talk louder  Coffee Logistics  16 enrolled, ~16 papers  replace presentations?  Discussion leader for next time?  Dropping/auditing? – contact me  Got my ?

 Read papers  Meet with group tomorrow  Send critique by 5 pm  Read critiques before class  Before class: send paper(s) you’d like to present  Also start looking at papers for project topic selection (preliminary proposal due Thursday next week)

 Read papers  Meet with group tomorrow  Send critique by 5 pm  Read critiques before class  Before class: send paper(s) you’d like to present  Also start looking at papers for project topic selection (preliminary proposal due Thursday next week) Questions?

 1–2 or 2–3: SJ  11–12: MFS  Another time (8:30–10:30, 11:30–1:30): DH Will you have time to write critiques after meeting?

Critiques & discussions – critically evaluate research & develop new ideas; understand ideas & concepts deeply Project – practice research process; make research contribution Motivation for material – more in 885

Java provides memory & type safety

 Buffer overflows, dangling pointers, array out-of- bounds, double frees, some memory leaks  How are these handled? With exceptions?

Java provides memory & type safety  Buffer overflows, dangling pointers, array out-of- bounds, double frees, some memory leaks  How are these handled? With exceptions? Should languages, runtime, & hardware systems provide concurrency correctness?

 Data-race freedom & sequential consistency  Locking discipline  Atomicity

 Data-race freedom & sequential consistency  Locking discipline  Atomicity  Also: enforcing atomicity  Also: record & replay

 Data-race freedom & sequential consistency  Locking discipline  Atomicity  Also: enforcing atomicity  Also: record & replay Advantages of exceptions vs. enforcement? Easier to provide exceptions vs. enforcement?

 Data-race freedom & sequential consistency  Locking discipline  Atomicity  Also: enforcing atomicity  Also: record & replay Advantages of exceptions vs. enforcement? Easier to provide exceptions vs. enforcement? Questions or other issues in paper?

 Two accesses to same variable  At least one is a write Not well-synchronized (not ordered by happens-before relationship) Or: accesses can happen simultaneously

T1: data =...; flag = true; 38 T2: if (flag)... = data; Initially: int data = 0; boolean flag = false;

T1: data =...; flag = true; 39 T2: if (flag)... = data; Initially: int data = 0; boolean flag = false;

T1: data =...; flag = true; 40 T2: if (flag)... = data; Initially: int data = 0; boolean flag = false;

T1: flag = true; data =...; 41 T2: if (flag)... = data; Initially: int data = 0; boolean flag = false;

T1: flag = true; data =...; 42 T2: if (flag)... = data; Initially: int data = 0; boolean flag = false; Why a sequential consistency violation?

T1: data =...; flag = true; 43 T2: tmp = data; if (flag)... = tmp; Initially: int data = 0; boolean flag = false;

T1: data =...; synchronized (m) { flag = true; } 44 T2: boolean tmp; synchronized (m) { tmp = flag; } if (tmp)... = data; Initially: int data = 0; boolean flag = false;

T1: data =...; acquire(m); flag = true; release(m); 45 T2: boolean tmp; acquire(m); tmp = flag; release(m); if (tmp)... = data; Initially: int data = 0; boolean flag = false; Happens-before relationship

T1: data =...; flag = true; 46 T2: if (flag)... = data; Initially: int data = 0; volatile boolean flag = false; Happens-before relationship

 Data-race freedom & sequential consistency  Locking discipline  Atomicity  Also: enforcing atomicity  Also: record & replay Advantages of exceptions vs. enforcement? Easier to provide exceptions vs. enforcement?

class Movie { Set comments; addComment(String s) { if (comments == null) { comments = new HashSet (); } comments.add(s); }

class Movie { Set comments; addComment(String s) { synchronized (this) { if (comments == null) { comments = new HashSet (); } comments.add(s); }

class Movie { Set comments; addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { comments = new HashSet (); } comments.add(s); }

addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { comments = new HashSet (); } comments.add(s); } addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { comments = new HashSet (); } comments.add(s); }

addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { HashSet temp = alloc HashSet; temp. (); comments = temp; } comments.add(s); } addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { comments = new HashSet (); } comments.add(s); }

addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { HashSet temp = alloc HashSet; temp. (); comments = temp; } comments.add(s); } addComment(String s) { if (comments == null) { synchronized (this) { if (comments == null) { comments = new HashSet (); } comments.add(s); }

55 class Vector { synchronized boolean contains(Object o) {... } synchronized void add(Object o) {... } }

56 class Vector { synchronized boolean contains(Object o) {... } synchronized void add(Object o) {... } } class Set { Vector vector; void add(Object o) { if (!vector.contains(o)) { vector.add(o); }