November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg.

Slides:



Advertisements
Similar presentations
Fast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems Håkan Sundell Philippas Tsigas.
Advertisements

TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A A A AAA A A A AA A Proving that non-blocking algorithms don't block.
Module R2 Overview. Process queues As processes enter the system and transition from state to state, they are stored queues. There may be many different.
Scalable and Lock-Free Concurrent Dictionaries
Wait-Free Reference Counting and Memory Management Håkan Sundell, Ph.D.
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Locality-Conscious Lock-Free Linked Lists Anastasia Braginsky & Erez Petrank 1.
CSE 373: Data Structures and Algorithms Lecture 19: Graphs III 1.
Artificial Intelligence (CS 461D)
TOWARDS A SOFTWARE TRANSACTIONAL MEMORY FOR GRAPHICS PROCESSORS Daniel Cederman, Philippas Tsigas and Muhammad Tayyab Chaudhry.
Midterm 2 Overview Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CS510 Concurrent Systems Class 2 A Lock-Free Multiprocessor OS Kernel.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
Search  Exhaustive/Blind Search Methods Depth First Search Breadth First Search  Heuristic Methods Hill Climbing Beam Search Best First Search…
U NIVERSITY OF M ASSACHUSETTS, A MHERST Department of Computer Science Emery Berger University of Massachusetts, Amherst Operating Systems CMPSCI 377 Lecture.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Who’s Afraid of a Big Bad Lock Nir Shavit Sun Labs at Oracle Joint work with Danny.
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
Java How to Program, 9/e CET 3640 Professor: Dr. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
1 Advanced Computer Programming Concurrency Multithreaded Programs Copyright © Texas Education Agency, 2013.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Data Structures Trees.
Practical and Lock-Free Doubly Linked Lists Håkan Sundell Philippas Tsigas.
Chapter Tow Search Trees BY HUSSEIN SALIM QASIM WESAM HRBI FADHEEL CS 6310 ADVANCE DATA STRUCTURE AND ALGORITHM DR. ELISE DE DONCKER 1.
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
Department of Computer Science A Static Program Analyzer to increase software reuse Ramakrishnan Venkitaraman and Gopal Gupta.
CS510 Concurrent Systems Jonathan Walpole. A Lock-Free Multiprocessor OS Kernel.
Threads in Java. History  Process is a program in execution  Has stack/heap memory  Has a program counter  Multiuser operating systems since the sixties.
Introduction to search Chapter 3. Why study search? §Search is a basis for all AI l search proposed as the basis of intelligence l inference l all learning.
November 15, 2007 A Java Implementation of a Lock- Free Concurrent Priority Queue Bart Verzijlenberg.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
Internet Software Development Controlling Threads Paul J Krause.
Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.
Binary trees -2 Chapter Threaded trees (depth first) Binary trees have a lot of wasted space: the leaf nodes each have 2 null pointers We can.
1 Searching Searching in a sorted linked list takes linear time in the worst and average case. Searching in a sorted array takes logarithmic time in the.
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.
Chapter 6 – Process Synchronisation (Pgs 225 – 267)
Concurrency Control 1 Fall 2014 CS7020: Game Design and Development.
Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects Maged M. Michael Presented by Abdulai Sei.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Concurrency & Dynamic Programming.
CS510 Concurrent Systems Jonathan Walpole. A Methodology for Implementing Highly Concurrent Data Objects.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Thread basics. A computer process Every time a program is executed a process is created It is managed via a data structure that keeps all things memory.
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
HEAPS. Review: what are the requirements of the abstract data type: priority queue? Quick removal of item with highest priority (highest or lowest key.
AVL Trees and Heaps. AVL Trees So far balancing the tree was done globally Basically every node was involved in the balance operation Tree balancing can.
Priority Queues Dan Dvorin Based on ‘The Art of Multiprocessor Programming’, by Herlihy & Shavit, chapter 15.
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
CS412/413 Introduction to Compilers and Translators April 21, 1999 Lecture 30: Garbage collection.
Verifying a Two-Lock Concurrent Queue Hussain Tinwala Fall 2007.
Priority Queues and Heaps Tom Przybylinski. Maps ● We have (key,value) pairs, called entries ● We want to store and find/remove arbitrary entries (random.
Chapter 12 – Data Structures
Heaps (8.3) CSE 2011 Winter May 2018.
Håkan Sundell Philippas Tsigas
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
Faster Data Structures in Transactional Memory using Three Paths
Priority Queues © 2010 Goodrich, Tamassia Priority Queues 1
Heaps 8/2/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser,
Hashing Exercises.
External Methods Chapter 15 (continued)
Expander: Lock-free Cache for a Concurrent Data Structure
Tree data structure.
Part-D1 Priority Queues
Tree data structure.
A Concurrent Lock-Free Priority Queue for Multi-Thread Systems
Heaps © 2014 Goodrich, Tamassia, Goldwasser Heaps Heaps
Multicore programming
CS210- Lecture 13 June 28, 2005 Agenda Heaps Complete Binary Tree
CMPT 225 Lecture 16 – Heap Sort.
Presentation transcript:

November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg

November 27, Agenda Brief Review Brief Review Verification Overview Verification Overview Verification Results Verification Results Errors Errors Further Work Further Work Conclusion Conclusion

November 27, Brief Review Priority Queue Priority Queue Lock-free Lock-free Relies on atomic Compare and Swap operations Relies on atomic Compare and Swap operations

November 27, Algorithm Review The algorithm uses the Skip-List data structure The algorithm uses the Skip-List data structure Extends the Skip-List for concurrent use Extends the Skip-List for concurrent use The Skip-List is sorted on the priority of the nodes The Skip-List is sorted on the priority of the nodes The algorithm is lock-free The algorithm is lock-free No blocking No blocking Prevent dead locks Prevent dead locks Always progress by at least one operation Always progress by at least one operation Risk of starvation Risk of starvation

November 27, Algorithm Review Skip-List Multi-layer linked list Multi-layer linked list H forward pointers for a node of height h H forward pointers for a node of height h Each pointer i points to the next node with a height of at least i Each pointer i points to the next node with a height of at least i

November 27, Inserting in a Skip-List Inserting 17 in the list

November 27, Verification Overview Java Path Finder Java Path Finder Breadth-First Search Breadth-First Search Depth-First Search Depth-First Search Modified JPF script Modified JPF script Increased stack size to 1536Mb Increased stack size to 1536Mb Vary the number of inserts/deletions Vary the number of inserts/deletions At what point does JPF crash? At what point does JPF crash?

November 27, Test Classes Driver Class Driver Class Creates Creates N insertThreads N insertThreads M deleteThreads M deleteThreads Insert Thread Insert Thread Inserts a single number into the queue Inserts a single number into the queue Delete Thread Delete Thread Loops until a single number removed from queue Loops until a single number removed from queue Use of sleep important Use of sleep important

November 27, Code Modifications Maximum Level = 3 Maximum Level = 3 Probabilistic level selection replaced with a random level Probabilistic level selection replaced with a random level Probabilistic function calls random multiple times Probabilistic function calls random multiple times Too many additional paths for JPF Too many additional paths for JPF Removed back-off period Removed back-off period

November 27, A Note At the end of the code At the end of the code Print “End of Code” Print “End of Code” Marks each time JPF reaches the end of a potential execution path Marks each time JPF reaches the end of a potential execution path I consider each “End of Code” to correspond with a different thread interleaving (i.e. a path) I consider each “End of Code” to correspond with a different thread interleaving (i.e. a path)

November 27, Verification Results (1,2) = 1 Insert Thread, 2 Delete Threads (1,2) = 1 Insert Thread, 2 Delete Threads 1,01,12,02,12,23,0 BFS 2 Paths No Error <1 Min 5 Paths No Error 1 Min 8 Paths No Error 1 Min ? Paths Out of memory 27 Min ? Paths Out of Memory 35 Min ? Paths Out of memory 34 Min DFS 2 Paths No Error <1 Min 5 Paths No Error <1 Min 10 Paths No Error <1 Min 15+ Paths Out of Memory 2:15 Hours 6+ Paths Out of Memory 15:40 Hours 18+ Paths Out of Memory 5:20 Hours

November 27, By Comparison Implemented simple priority queue test Implemented simple priority queue test java.util.PriorityQueue java.util.PriorityQueue Not safe for concurrency Not safe for concurrency Synchronized insert statement using a lock on the queue Synchronized insert statement using a lock on the queue Able to test inserting 8 numbers quickly Able to test inserting 8 numbers quickly 3713 Paths 3713 Paths Tested in 45 Min Tested in 45 Min Inserting 10 numbers Inserting 10 numbers Crashed after Paths Crashed after Paths

November 27, What is the Difference? Using synchronized method Using synchronized method Very few points where a thread can take over Very few points where a thread can take over I.e. When one thread is inserting, none of the others can insert at the same time I.e. When one thread is inserting, none of the others can insert at the same time Lock Free Lock Free Threads can be interrupted after every instruction Threads can be interrupted after every instruction This results in many more potential interleavings This results in many more potential interleavings

November 27, Errors ! java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: GC overhead limit exceeded GC overhead limit exceeded More than 98% of time spent on GC More than 98% of time spent on GC Recovering less than 2% of the heap Recovering less than 2% of the heap java.lang.OutOfMemoryError: java.lang.OutOfMemoryError: Java heap space Java heap space [SEVERE] JPF out of memory [SEVERE] JPF out of memory [SEVERE] JPF exception, terminating: [SEVERE] JPF exception, terminating: class java.lang.NullPointerException: null class java.lang.NullPointerException: null

November 27, Further Work Reduce Max level to 2 Reduce Max level to 2 Further reducing number of paths Further reducing number of paths Enable back-off function Enable back-off function Find linearization points in the code Find linearization points in the code Add each number into two queues at the same time Add each number into two queues at the same time Try some of the other search classes Try some of the other search classes

November 27, Conclusion Testing at this point has not found errors Testing at this point has not found errors When inserting up to 2 numbers When inserting up to 2 numbers When inserting 3 numbers (before crashing) When inserting 3 numbers (before crashing) More work needed to reduce the chance of errors further More work needed to reduce the chance of errors further Will not eliminate completely Will not eliminate completely

November 27, 2007 Thank You Questions?