November 15, 2007 A Java Implementation of a Lock- Free 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

Wait-Free Linked-Lists Shahar Timnat, Anastasia Braginsky, Alex Kogan, Erez Petrank Technion, Israel Presented by Shahar Timnat 469-+
 Definition of B+ tree  How to create B+ tree  How to search for record  How to delete and insert a data.
Scalable and Lock-Free Concurrent Dictionaries
Introduction to C Programming CE Lecture 12 Circular Queue and Priority Queue Data Structures.
CS Data Structures II Review COSC 2006 April 14, 2017
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Universidad Nacional de Colombia Facultad de Ingeniería Departamento de Sistemas nalysis of lgorithms.
SKIPLISTS A Probabilistic Alternative to Balanced Trees.
Outline Scapegoat Trees ( O(log n) amortized time)
CMPT 225 Priority Queues and Heaps. Priority Queues Items in a priority queue have a priority The priority is usually numerical value Could be lowest.
CS 315 March 24 Goals: Heap (Chapter 6) priority queue definition of a heap Algorithms for Insert DeleteMin percolate-down Build-heap.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
BST Data Structure A BST node contains: A BST contains
CS510 Concurrent Systems Class 2 A Lock-Free Multiprocessor OS Kernel.
Heaps & Priority Queues Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
1 Heaps. 2 Background: Priority Queues. zQueues are a First-In, First-Out data structure; zPriority Queues are similar, except those of highest priority.
Software Transaction Memory for Dynamic-Sized Data Structures presented by: Mark Schall.
Skip Lists1 Skip Lists William Pugh: ” Skip Lists: A Probabilistic Alternative to Balanced Trees ”, 1990  S0S0 S1S1 S2S2 S3S3 
Trees Main and Savitch Chapter 10. Binary Trees A binary tree has nodes, similar to nodes in a linked list structure. Data of one sort or another may.
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
Maps A map is an object that maps keys to values Each key can map to at most one value, and a map cannot contain duplicate keys KeyValue Map Examples Dictionaries:
Compiled by: Dr. Mohammad Alhawarat BST, Priority Queue, Heaps - Heapsort CHAPTER 07.
PRIORITY QUEUES (HEAPS). Queues are a standard mechanism for ordering tasks on a first-come, first-served basis However, some tasks may be more important.
Nachos Phase 1 Code -Hints and Comments
CS510 Concurrent Systems Jonathan Walpole. A Lock-Free Multiprocessor OS Kernel.
12-CRS-0106 REVISED 8 FEB 2013 CSG2A3 ALGORITMA dan STRUKTUR DATA.
ADT Table and Heap Ellen Walker CPSC 201 Data Structures Hiram College.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.
Symbol Tables and Search Trees CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Arboles B External Search The algorithms we have seen so far are good when all data are stored in primary storage device (RAM). Its access is fast(er)
1 Lock-Free concurrent algorithm for Linked lists: Verification CSE-COSC6490A : Concurrent Object-Oriented Languages York University - W09 Speaker: Alexandre.
ICS 313: Programming Language Theory Chapter 13: Concurrency.
HEAPS • Heaps • Properties of Heaps • HeapSort
1 Joe Meehean.  We wanted a data structure that gave us... the smallest item then the next smallest then the next and so on…  This ADT is called a priority.
Priority Queues and Heaps. October 2004John Edgar2  A queue should implement at least the first two of these operations:  insert – insert item at the.
Skip Lists 二○一七年四月二十五日
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
Skiplist-based Concurrent Priority Queues Itay Lotan Stanford University Nir Shavit Sun Microsystems Laboratories.
A Simple Optimistic skip-list Algorithm Maurice Herlihy Brown University & Sun Microsystems Laboratories Yossi Lev Brown University & Sun Microsystems.
Range Queries in Non-blocking k-ary Search Trees Trevor Brown Hillel Avni.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
CS510 Concurrent Systems Jonathan Walpole. A Methodology for Implementing Highly Concurrent Data Objects.
CS223 Advanced Data Structures and Algorithms 1 Priority Queue and Binary Heap Neil Tang 02/09/2010.
Heaps & Priority Queues
1/14/20161 BST Operations Data Structures Ananda Gunawardena.
Advanced Data Structure By Kayman 21 Jan Outline Review of some data structures Array Linked List Sorted Array New stuff 3 of the most important.
November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg.
Lock-Free Binary Search Tree Presented by Joanna Helga.
SkipLists and Balanced Search The Art Of MultiProcessor Programming Maurice Herlihy & Nir Shavit Chapter 14 Avi Kozokin.
Priority Queues CS 110: Data Structures and Algorithms First Semester,
Give Eg:? Queues. Introduction DEFINITION: A Queue is an ordered collection of element in which insertions are made at one end and deletions are made.
An algorithm of Lock-free extensible hash table Yi Feng.
Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects MAGED M. MICHAEL PRESENTED BY NURIT MOSCOVICI ADVANCED TOPICS IN CONCURRENT PROGRAMMING,
CS510 Concurrent Systems Tyler Fetters. A Methodology for Implementing Highly Concurrent Data Objects.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
1 The Standard Template Library The STL is a collection of Container classes These are class templates for containers. A container is an object that stores.
Priority Queues and Heaps Tom Przybylinski. Maps ● We have (key,value) pairs, called entries ● We want to store and find/remove arbitrary entries (random.
Leftist Trees Linked binary tree.
Priority Queues A priority queue is an ADT where:
Design & Analysis of Algorithm Priority Queue
Priority Queues and Heaps
Lecture 22 Binary Search Trees Chapter 10 of textbook
Concurrent Data Structures Concurrent Algorithms 2017
Hassan Khosravi / Geoffrey Tien
Random inserting into a B+ Tree
A Concurrent Lock-Free Priority Queue for Multi-Thread Systems
Multicore programming
Synchronization and liveness
Presentation transcript:

November 15, 2007 A Java Implementation of a Lock- Free Concurrent Priority Queue Bart Verzijlenberg

November 15, Agenda Algorithm Review Algorithm Review Implementation Implementation Java Package used Java Package used Testing Testing Conclusion Conclusion Questions Questions

November 15, Algorithm Review Priority Queue Priority Queue Lock-free Lock-free Relies on atomic Compare and Swap operations Relies on atomic Compare and Swap operations

November 15, 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 15, Algorithm Review Skip-List Multi-layer linked list Multi-layer linked list Probabilistic alternative to balanced trees Probabilistic alternative to balanced trees H forward pointer for a node of height h H forward pointer 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 Probabilistic time complexity log(N) for N nodes Probabilistic time complexity log(N) for N nodes

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

November 15, Implementation Two classes Two classes Node Node Represents an entry in the queue Represents an entry in the queue SkipQueue SkipQueue Contains the algorithm logic Contains the algorithm logic

November 15, Node Class

November 15, SkipQueue Class

November 15, Java Package Used AtomicMarkableReference AtomicMarkableReference In Java.util.concurrent.atomic In Java.util.concurrent.atomic Stores Stores A reference to an object A reference to an object A boolean flag A boolean flag Provides ability to Provides ability to Atomically set both the flag and reference Atomically set both the flag and reference Compare and Swap (CAS) the flag and reference Compare and Swap (CAS) the flag and reference

November 15, Testing Multi-threaded Multi-threaded 10 insert threads 10 insert threads Each inserting 100,000 objects with random integer keys Each inserting 100,000 objects with random integer keys 10 delete threads 10 delete threads Each deleting while the queue is not empty Each deleting while the queue is not empty If the queue is empty, sleep for a bit and try again If the queue is empty, sleep for a bit and try again

November 15, Testing Maintain a counter Maintain a counter Stores the number of nodes dequeued Stores the number of nodes dequeued When 1,000,000 nodes removed When 1,000,000 nodes removed Stop the delete threads Stop the delete threads Check that Check that the queue is empty the queue is empty removed exactly 1,000,000 nodes removed exactly 1,000,000 nodes

November 15, Testing 10 insert threads 10 insert threads Each inserting 100,000 random integer numbers Each inserting 100,000 random integer numbers When all numbers have been inserted When all numbers have been inserted Remove them one at a time. Remove them one at a time. Making sure the nodes come out sorted Making sure the nodes come out sorted

November 15, Removing Atomicity Do atomic references make a difference Do atomic references make a difference i.e. does concurrency come into play, or are we just lucky i.e. does concurrency come into play, or are we just lucky Replace each AtomicMarkableReference with a similar class Replace each AtomicMarkableReference with a similar class Same functions Same functions But they are not atomic But they are not atomic The queue becomes locked after a small number of concurrent deletes. The queue becomes locked after a small number of concurrent deletes.

November 15, Conclusion Further testing is needed to verify the correctness of the implementation Further testing is needed to verify the correctness of the implementation Tests so far are positive Tests so far are positive But cannot be certain there are no problems But cannot be certain there are no problems

November 15, 2007 Questions