Lock Free Linked List and Skip List

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-+
Linked Lists. 2 Merge Sorted Lists Write an algorithm that merges two sorted linked lists The function should return a pointer to a single combined list.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
Chapter 6 Process Synchronization Bernard Chen Spring 2007.
Scalable and Lock-Free Concurrent Dictionaries
Data Structures: A Pseudocode Approach with C
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Contd... Objectives Explain the design, use, and operation of a linear list Implement a linear.
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists.
1 Lock-Free Linked Lists Using Compare-and-Swap by John Valois Speaker’s Name: Talk Title: Larry Bush.
1 Lock-Free concurrent algorithm for Linked lists: Verification CSE-COSC6490A : Concurrent Object-Oriented Languages York University - W09 Speaker: Alexandre.
A Simple Optimistic skip-list Algorithm Maurice Herlihy Brown University & Sun Microsystems Laboratories Yossi Lev Brown University & Sun Microsystems.
1. Circular Linked List In a circular linked list, the last node contains a pointer to the first node of the list. In a circular linked list,
Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists.
SkipLists and Balanced Search The Art Of MultiProcessor Programming Maurice Herlihy & Nir Shavit Chapter 14 Avi Kozokin.
An algorithm of Lock-free extensible hash table Yi Feng.
CS510 Concurrent Systems Tyler Fetters. A Methodology for Implementing Highly Concurrent Data Objects.
Managing Hierarchies of Database Elements Section 18.6 CS257 Jack Price.
Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Concurrent Skip Lists.
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
Skip Lists S3   S2   S1   S0  
Topic 2: binary Trees COMP2003J: Data Structures and Algorithms 2
C++ Programming:. Program Design Including
Skip Lists 5/10/2018 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M.
Section 18.6: Managing Hierarchies of Database Elements
Program based on queue & their operations for an application
Big-O notation Linked lists
CE 221 Data Structures and Algorithms
Prepared by, Jesmin Akhter, Lecturer, IIT, JU
Håkan Sundell Philippas Tsigas
Lock-Free Linked Lists Using Compare-and-Swap
CS 332: Algorithms Hash Tables David Luebke /19/2018.
Week 8 - Wednesday CS221.
Problems with Linked List (as we’ve seen so far…)
Queues Queues Queues.
Extra: B+ Trees CS1: Java Programming Colorado State University
Concepts of programming languages
Lecture 22 Binary Search Trees Chapter 10 of textbook
CMSC 341 Lecture 13 Leftist Heaps
Skip Lists S3 + - S2 + - S1 + - S0 + -
Linked Lists head One downside of arrays is that they have a fixed size. To solve this problem of fixed size, we’ll relax the constraint that the.
Red-Black Trees Motivations
LINKED LISTS CSCD Linked Lists.
Prof. Neary Adapted from slides by Dr. Katherine Gibson
Data Structures and Algorithms
CMSC 341 Lecture 10 B-Trees Based on slides from Dr. Katherine Gibson.
Optimizing Malloc and Free
Concurrent Data Structures Concurrent Algorithms 2016
Linear and Binary Search
CS Introduction to Operating Systems
Arrays and Linked Lists
Concurrent Data Structures Concurrent Algorithms 2017
Skip Lists S3 + - S2 + - S1 + - S0 + -
Lock-Free concurrent algorithm for Linked lists: Implementation
Find in a linked list? first last 7  4  3  8 NULL
Section 18.8 : Concurrency Control – Timestamps -CS 257, Rahul Dalal - SJSUID: Edited by: Sri Alluri (313)
Multicore programming
Doubly Linked Lists Lecture 21 Tue, Mar 21, 2006.
Building Java Programs
A Robust Data Structure
A Concurrent Lock-Free Priority Queue for Multi-Thread Systems
CS210- Lecture 5 Jun 9, 2005 Agenda Queues
Multicore programming
Data Structures & Algorithms
CSC 143 Binary Search Trees.
Multicore programming
EECE.3220 Data Structures Instructor: Dr. Michael Geiger Spring 2019
Amir Kamil 8/8/02 1 B+ Trees Similar to B trees, with a few slight differences All data is stored at the leaf nodes (leaf pages); all other nodes (index.
Presentation transcript:

Lock Free Linked List and Skip List Eric Ruppert Mikhail Fomitchev

Concurrent Algorithm Why this Algorithm is significant : Building blocks for many other Data structures. Better performance than earlier algorithms Problems with Mutual Exclusion: 1. delay of one process can cause performance degradation and priority inversion When halting failures occur entire system fails.

General Problem in lock free system When a process is deleting node X by performing a C&S on X’s predecessor,and a concurrent operation changes X’s Right pointer results in incorrect executions Harris’s Solution Introduced Mark bits and 2-step Deletion process but still problem persists.

Problem with Deletion Process P1 wants to insert a node after node X Process P2 attempts to delete node X. When P1 and P2 performs concurrent operations and suppose that,just before P1 is about to execute C&S,P2 marks node X,then P1 will fail. Then P1 has to restart from the beginning of the list which leads to poor performance.

Harri’s Two Step Deletion B C A B C A B C Initial configuration 1.Marking 2.Physical Deletion Three Step Deletion in This Algorithm B A C A B C Initial configuration Step 1.Marking A B C A B C Step 2:Setting the backlink and marking Step 3:Physical Deletion

Key Techniques Back link pointers which points to previous node Mark bit which is used as a toggle to indicate whether a node’s right pointer can be changed. Flag bit to indicate deletion of node is on the way and its successor is fixed. Thus when P1 finds a node marked,it traverses to its predecessor by using back link pointer and traverses until it finds an unmarked node U.Then it adds the node after U.This gives a better performance than restarting from beginning of list.

Algorithm Pre-requisites : The linked list is ordered by their keys Duplicates are not allowed in the list Each node has : Key , Element , Backlink and Successor Successor has : Right pointer,Mark bit and Flag bit Insertion : 1.Calls the sub-routine SearchFrom to identify where to insert the new key. SearchFrom returns two nodes n1 and n2 such that n1.right = n2 and n1.key ≤ k < n2.key. 2.Check for duplicates and create and insert new node

Scenarios: prev_node may be flagged - calls HelpFlagged routine,which helps to complete the deletion and removes the flag. prev_ node got marked- Insert traverses the backlinks until it finds an unmarked node and then sets prev node to point to it (lines 17-18). In any case, in line 19 Insert invokes SearchFrom starting from prev node to find the correct location for the insertion in the updated list,and updates its prev node and next node pointers. Then Insert enters the next iteration of the loop. Deletion : 1. Calls SearchFrom, and then calls TryFlag to perform the first deletion step (flagging the predecessor). TryFlag – repeatedly attempts to flag del node’s predecessor, until the flag is placed or del node gets deleted. TryFlag returns two values: a node pointer prev node and a boolean result value.

Scenarios : 1.If already flagged,returns pre_node and result = false 2.If del_node already deleted,returns null and false. If prev node returned is not null,it performs second and third steps of deletion by calling try mark and help marked. Amortised cost : T(s) € O(n(s) + c(s)) S – operation , n – no of elements in list and c(s) – concurrent overhead during the opeartion S.

Thank You