Hint for Assignment#3: Implementing Lockset-Based Data Race Detector

Slides:



Advertisements
Similar presentations
Stacks and Queues. Not really data structures – More of an enforcement of policy – Can be implemented using an array or linked list – Can store just about.
Advertisements

CS252: Systems Programming Ninghui Li Program Interview Questions.
0 of 37 Stacks and Queues Lecture of 37 Abstract Data Types To use a method, need to know its essentials: signature and return type o additionally,
ADT Stacks and Queues. Stack: Logical Level “An ordered group of homogeneous items or elements in which items are added and removed from only one end.”
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO and THOMAS ANDERSON.
Prof. Moonzoo Kim Computer Science, KAIST
Today’s Agenda  Midterm: Nov 3 or 10  Finish Message Passing  Race Analysis Advanced Topics in Software Engineering 1.
CS 263 Course Project1 Survey: Type Systems for Race Detection and Atomicity Feng Zhou, 12/3/2003.
Atomicity Violation Detection Prof. Moonzoo Kim CS492B Analysis of Concurrent Programs.
CS533 Concepts of Operating Systems Class 3 Data Races and the Case Against Threads.
Fall 2008ACS-1805 Ron McFadyen1 Ch 8 Recursion Recursion occurs when a method (or function) calls itself.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
1 Stack Data : a collection of homogeneous elements arranged in a sequence. Only the first element may be accessed Main Operations: Push : insert an element.
/ PSWLAB Eraser: A Dynamic Data Race Detector for Multithreaded Programs By Stefan Savage et al 5 th Mar 2008 presented by Hong,Shin Eraser:
Java Collections. Collections, Iterators, Algorithms CollectionsIteratorsAlgorithms.
The Stack and Queue Types Lecture 10 Hartmut Kaiser
ADT Stacks and Queues. Stack: Logical Level “An ordered group of homogeneous items or elements in which items are added and removed from only one end.”
SEG4110 – Advanced Software Design and Reengineering TOPIC G Java Collections Framework.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Stacks and queues Basic operations Implementation of stacks and queues Stack and Queue in java.util Data Structures and Algorithms in Java, Third EditionCh04.
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
Stacks and Queues Introduction to Computing Science and Programming I.
Chapter 15: Advanced Topics: Introducing Data Structures and Recursion Visual Basic.NET Programming: From Problem Analysis to Program Design.
Eraser: A Dynamic Data Race Detector for Multithreaded Programs STEFAN SAVAGE, MICHAEL BURROWS, GREG NELSON, PATRICK SOBALVARRO, and THOMAS ANDERSON Ethan.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
Collections. The Plan ● Why use collections? ● What collections are available? ● How are the collections different? ● Examples ● Practice.
Data structures Abstract data types Java classes for Data structures and ADTs.
CSE 501N Fall ‘09 11: Data Structures: Stacks, Queues, and Maps Nick Leidenfrost October 6, 2009.
Hint for Assignment#4: Implementing Lockset-Based Data Race Detector Prof. Moonzoo Kim Computer Science, KAIST CS492B Analysis of Concurrent Programs.
COP INTERMEDIATE JAVA Data Structures. A data structure is a way of organizing a collection of data so that it can be manipulated effectively. A.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
Stacks And Queues Chapter 18.
1 Lecture 14: Queues Lecturer: Santokh Singh CompSci 105 SS 2005 Principles of Computer Science.
Week 5 - Wednesday.  What did we talk about last time?  Recursion  Definitions: base case, recursive case  Recursive methods in Java.
Understanding General Software Development Lesson 3.
ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: Tel 3049.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
Data-structure-palooza Checkout DataStructures from SVN.
Computer Engineering Rabie A. Ramadan Lecture 6.
Stacks and Queues CMSC 201. Stacks and Queues Sometimes, when we use a data-structure in a very specific way, we have a special name for it. This is to.
Stacks & Queues CSC 172 SPRING 2002 LECTURE 4 Agenda  Stack  Definition  Implementation  Analysis  Queue  Definition  Implementation  Analysis.
3/3/20161 Stacks and Queues Introduction to Data Structures Ananda Gunawardena.
Understanding General Software Development Lesson 3.
Data Structures Intro2CS – week Stack ADT (Abstract Data Type) A container with 3 basic actions: – push(item) – pop() – is_empty() Semantics: –
1 Data Organization Example 1: A simple text editor –Store the text buffer as a list of lines. –How would we implement the UNDO operation? Example 2: Parsing.
Collections ABCD ABCD Head Node Tail Node array doubly linked list Traditional Arrays and linked list: Below is memory representation of traditional.
Detecting Data Races in Multi-Threaded Programs
Building Java Programs
G64ADS Advanced Data Structures
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Chapter 12 – Data Structures
QueueStack CS1020.
Stacks and Queues.
Chapter 15 Lists Objectives
Stacks and Queues.
Stacks and Queues.
Building Java Programs
structures and their relationships." - Linus Torvalds
structures and their relationships." - Linus Torvalds
ITEC 2620M Introduction to Data Structures
Lesson 6. Types Equality and Identity. Collections.
ITEC 2620M Introduction to Data Structures
Recitation Outline C++ STL associative containers Examples
Locking in Java.
Stacks and Queues CLRS, Section 10.1.
Stacks and Queues Prof. Michael Tsai 2017/02/21.
More Data Structures (Part 1)
slides created by Alyssa Harding
CS 240 – Advanced Programming Concepts
structures and their relationships." - Linus Torvalds
Presentation transcript:

Hint for Assignment#3: Implementing Lockset-Based Data Race Detector CS492B Analysis of Concurrent Programs Hint for Assignment#3: Implementing Lockset-Based Data Race Detector Prof. Moonzoo Kim Computer Science, KAIST

Java Data Structure HashMap LinkedList HashSet “dictionary” in Java map.put(key, value) / map.get(key) LinkedList can be used for stack or queue Stack (LIFO): push = list.addFirst(x) pop = list.removeFirst() Queue (FIFO): enqueue = list.addFirst(x) dequeue= list.removeLast() HashSet do not contain duplicated elements s1.retainAll(s2): remove s1’s elements that are not in s2

Data Structure for Thread HashMap<Integer, LinkedList<Integer>> stacks Key: thread identifier Value: a sequence of iids on methodEnter executions c.f. HashMap is “dictionary” in Java HashMap<Integer, LinkedList<Integer>> heldLocks Value: a sequence of lock identifiers currently held by this thread A list is used instead of a set to consider recursive locking

Memory Location State Eraser maintains the state for each memory location to check if it is in initialization, and if read-shared. state C(v) = {*} candidates firstThread Initialization C(v) is not updated C(v) = C(v)∩L(t), report if C(v)=∅ C(v) = C(v)∩L(t) (no bug report) Read-shared

Data Structure for Memory Address (1/2) HashMap<Long, HashSet<Integer>> candidates Key: memory Value: a set of candidate locks HashMap<Integer, MemoryState> state Value: the monitoring state of the memory

Data Structure for Memory Address (2/2) HashMap<Long, Integer> firstThread Key: memory Value: thread that first accesses memory HashMap<Integer, Integer> lastAccessLoc Value: iid of an operation that access memory right before the data race detection javato.activetesting.analysis.Observer.getIidToLoc(iid) converts iid to the corresponding code line information

Lockset Algorithm Example Initially, balance: 10 class Account { long balance; //must be non-negative void withdraw(long x){ 1 if(balance >= x){ 2 synchronized(this){ 3 balance=balance – x; 4 } 5 } } void deposit(long x){ 11 synchronized(this){ 12 balance=balance + x; 13 } t1: deposit(10) t2: withdraw(5) 11:lock(this) 12:t=balance lastAccessLoc (balance): 12 12:balance=t+10 13:unlock(this) C(balance) = {*} ∩ L(t2) = ∅ 1:if(balance>=5) 2:lock(this) 3:t=balance 3:balance=t-5 4:unlock(this)