1 1 Nastaran Shafiei VERIFICATION OF A NON-BLOCKING ARRAY-BASED QUEUE ALGORITHM.

Slides:



Advertisements
Similar presentations
IBM T. J. Watson Research Center Conditions for Strong Synchronization Maged Michael IBM T J Watson Research Center Joint work with: Martin Vechev, Hagit.
Advertisements

© 2004 Goodrich, Tamassia Queues1. © 2004 Goodrich, Tamassia Queues2 The Queue ADT (§4.3) The Queue ADT stores arbitrary objects Insertions and deletions.
Hongjin Liang and Xinyu Feng
1 Model checking. 2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Queues1 Part-B2 Queues. Queues2 The Queue ADT (§4.3) The Queue ADT stores arbitrary objects Insertions and deletions follow the first-in first-out scheme.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
1 Queues – Chapter 3 A queue is a data structure in which all additions are made at one end called the rear of the queue and all deletions are made from.
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.”
Lab 1: 1. Download all my programs in your computer under the same folder. 2. The tree shown in the following figure represents an expression: (((( 3 +
Queues 4/14/2017 5:24 PM 5.2 Queues Queues Dr Zeinab Eid.
1 Queues (5.2) CSE 2011 Winter May Announcements York Programming Contest Link also available from.
JML and Class Specifications Class invariant JML definitions Queue example Running JML in Eclipse.
Queues. … frontrear dequeueenqueue Message queues in an operating system There are times that programs need to communicate with each other.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Queues CS-240 & CS-341 Dick Steflik. Queues First In, First Out operation - FIFO As items are added they are chronologically ordered, items are removed.
Basic Definitions Data Structures: Data Structures: A data structure is a systematic way of organizing and accessing data. Or, It’s the logical relationship.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
© 2004 Goodrich, Tamassia Queues1. © 2004 Goodrich, Tamassia Queues2 The Queue ADT (§4.3) The Queue ADT stores arbitrary objects Insertions and deletions.
Java Race Finder Checking Java Programs for Sequential Consistency Tuba Yavuz-Kahveci Fall 2013.
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.”
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
Stack and Queue.
Advanced Java Session 3 New York University School of Continuing and Professional Studies.
Linearizability By Mila Oren 1. Outline  Sequential and concurrent specifications.  Define linearizability (intuition and formal model).  Composability.
Object Oriented Programming Lecture 8: Introduction to laboratorial exercise – part II, Introduction to GUI frames in Netbeans, Introduction to threads.
1 Threads  Sequential Execution: Here statements are executed one after the other.They consider only a single thread of execution, where thread is an.
Java PathFinder (JPF) cs498dm Software Testing January 19, 2012.
Queues by Dr. Bun Yue Professor of Computer Science CSCI 3333 Data Structures.
Lecture7: Queue Bohyung Han CSE, POSTECH CSED233: Data Structures (2014F)
Lab 7 Queue ADT. OVERVIEW The queue is one example of a constrained linear data structure. The elements in a queue are ordered from least recently added.
Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.
Verification of obstruction-free algorithm with contention management Niloufar Shafiei.
1 Lock-Free concurrent algorithm for Linked lists: Verification CSE-COSC6490A : Concurrent Object-Oriented Languages York University - W09 Speaker: Alexandre.
JAVA MEMORY MODEL AND ITS IMPLICATIONS Srikanth Seshadri
Addendum to Lab 10 What was all that about?. Consider… A static queue class – It has one copy of the queue in the class’s memory : public class StaticQClass.
Data Structures: A Pseudocode Approach with C1 Chapter 4 Objectives Upon completion you will be able to: Explain the design, use, and operation of a queue.
Queues CSCI 3333 Data Structures. Acknowledgement  Dr. Bun Yue  Mr. Charles Moen  Dr. Wei Ding  Ms. Krishani Abeysekera  Dr. Michael Goodrich  Dr.
1 Model Checking of Robotic Control Systems Presenting: Sebastian Scherer Authors: Sebastian Scherer, Flavio Lerda, and Edmund M. Clarke.
Model Checking Linearizability via Refinement 1 ICFEM 2008 Model Checking Linearizability via Refinement Yang LIU, Wei CHEN, Yanhong A. LIU, and Jun SUN.
UNIT II Queue. Syllabus Contents Concept of queue as ADT Implementation using linked and sequential organization. – linear – circular queue Concept –
Queue. Avoid confusion Britain Italy 6 Applications of Queues Direct applications –Waiting lists, bureaucracy –Access to shared resources (e.g.,
M180: Data Structures & Algorithms in Java Queues Arab Open University 1.
November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg.
Copyright © Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Java From Control Structures through Data Structures by Tony.
Queue. The Queue ADT Insertions and deletions follow the first-in first-out scheme Insertions are at the rear of the queue and removals are at the front.
Type soundness In a more formal way. Proving Soundness of Type Systems Goal of a sound type system: –if the program type checks, then it never “crashes”
CH 5 : STACKS, QUEUES, AND DEQUES ACKNOWLEDGEMENT: THE SLIDES ARE PREPARED FROM SLIDES PROVIDED WITH DATA STRUCTURES AND ALGORITHMS IN C++, GOODRICH, TAMASSIA.
Spring 2008 Mark Fontenot CSE Honors Principles of Computer Science I Note Set 15 1.
CSC 480 Software Engineering Lab 2 – Multi-Threading Oct 18, 2002.
Simplifying Linearizability Proofs Using Reduction and Abstraction Serdar Tasiran Koc University, Istanbul, Turkey Tayfun Elmas, Ali Sezgin, Omer Subasi.
© 2004 Goodrich, Tamassia Queues. © 2004 Goodrich, Tamassia Stacks2 The Queue ADT The Queue ADT stores arbitrary objects Insertions and deletions follow.
Concurrency 2 CS 2110 – Spring 2016.
Chapter 6 Queue.
Queues 11/9/2018 6:28 PM Queues 11/9/2018 6:28 PM Queues.
Multithreaded Programming in Java
Queues 11/16/2018 4:18 AM Queues 11/16/2018 4:18 AM Queues.
Queues 11/16/2018 4:19 AM Queues 11/16/2018 4:19 AM Queues.
Queues 11/22/2018 6:47 AM 5.2 Queues Queues Dr Zeinab Eid.
Condition Variables and Producer/Consumer
Introduction to Java Programming
Condition Variables and Producer/Consumer
Queues 3/9/15 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser,
Queues 12/30/2018 9:24 PM Queues 12/30/2018 9:24 PM Queues.
Chapter 6 Queue.
class PrintOnetoTen { public static void main(String args[]) {
IMPLEMENTATION OF A NON-BLOCKING QUEUE ALGORITHM
Chapter 6 Queue.
Foundations and Definitions
Data Structures & Programming
Presentation transcript:

1 1 Nastaran Shafiei VERIFICATION OF A NON-BLOCKING ARRAY-BASED QUEUE ALGORITHM

2 2  Algorithm Description  Algorithm Implementation  Verification  Simulating Shared Variables  Linearizability  Java Pathfider Results Outline

3 3  Finite array, Q  Counters, FRONT and REAR  Operations: enqueue, dequeue  Elements of the queue  Using compare-and-swap The Algorithm

4 NonblockingQueue L: int Q: AtomicLongArray REAR: AtomicLong FRONT: AtomicLong Enqueue v al: int Enqueue(int value) void run() Dequeue void run() Thread … … getValPart(long queue) getRefPart(long var) getQueueItem(int val, int ref) main(String[] args) Implementation

5 5 Shared Variables public static AtomicLongArray Queue; public static AtomicLong REAR; public static AtomicLong FRONT; Atomic variables Extend the concept of volatile variables compareAndSet() not supported by java pathfinder

6 6 Simulating Atomic Variables AtomicLongArray long array AtomicLong long Using volatile keyword Simulating compareAndSwap() synchronized method Atomic execution methods  beginAtomic() and endAtomic()  Declared in gov.nasa.jpf.jvm.Verify  Atomic block with respect to the whole program

77 Linearizability Correctness condition Definition: every concurrent execution = some legal sequential execution Linearization point (enqueue) AB Enqueue process: C Queue.compareAndSet( i, expected, newItem) = true

88 Linearizability Linearization point (dequeue) To prove linearizability  Invariants were developed describing expected properties of the shared variables. AB Dequeue process: C Queue.compareAndSet( i, expected, emptyItem)=true

99 Linearizability Auxiliary variablesShared Variables long rREAR long fFRONT long aq[]Q[]

10 Linearizability At enqueue linearization point: aq[r%L] = newItem r++ At dequeue linearization point: aq[f%L] = emptyItem f++

11 Linearizability InvariantPlace of assertion REAR == r-1Enqueue linearization point FRONT == f-1 Dequeue linearization point aq[r%L] == Q[REAR%L] synchronized CAS of REAR aq[f%L] == Q[FRONT%L]synchronized CAS of FRONT Assertion method Declared in gov.nasa.jpf.jvm.Verify public static void assert ( boolean b) Checks that b evaluates to true

12 Java Pathfinder Results Using beginAtomic() and endAtomic()  Purpose: Simulate CAS/cut down state space Jpf killed a thread and exited (even for 1 thread) Using synchronized method to simulate CAS  Up to 3 threads: no errors detected  4 threads: DFS : no errors detected BFS gave Out.MemoryError : GC overhead limit exceeded  More: Out.MemoryError

13 Questions?