Scalable Flat-Combining Based Synchronous Queues Danny Hendler, Itai Incze, Nir Shavit and Moran Tzafrir Presentation by Uri Golani.

Slides:



Advertisements
Similar presentations
Linked lists CSCI 2170.
Advertisements

Synchronization. How to synchronize processes? – Need to protect access to shared data to avoid problems like race conditions – Typical example: Updating.
Reduction, abstraction, and atomicity: How much can we prove about concurrent programs using them? Serdar Tasiran Koç University Istanbul, Turkey Tayfun.
CS252: Systems Programming Ninghui Li Program Interview Questions.
Review of Stacks and Queues Dr. Yingwu Zhu. Our Focus Only link-list based implementation of Stack class Won’t talk about different implementations of.
Data Structures: A Pseudocode Approach with C
CS Data Structures II Review COSC 2006 April 14, 2017
Linked Lists Compiled by Dr. Mohammad Alhawarat CHAPTER 04.
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Shared Counters and Parallelism Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
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.
Summary of lectures (1 to 11)
C# Programming: From Problem Analysis to Program Design1 Advanced Collections C# Programming: From Problem Analysis to Program Design 3 rd Edition 8.
INTRODUCTION TO DATA STRUCTURE. Topics To Be Discussed………………………. Meaning of Data Structure Classification of Data Structure Data Structure Operations.
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.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
Ceng-112 Data Structures ITurgut Kalfaoglu 1 Chapter 3 Stacks.
Implementing Stacks Ellen Walker CPSC 201 Data Structures Hiram College.
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
Chapter 4 Stacks Stacks A stack is a linear data structure that can be accessed only at one of its ends for storing and retrieving. Its called.
CS510 Concurrent Systems Jonathan Walpole. A Lock-Free Multiprocessor OS Kernel.
CS 1031 Linked Lists Definition of Linked Lists Examples of Linked Lists Operations on Linked Lists Linked List as a Class Linked Lists as Implementations.
1 Chapter 17 Object-Oriented Data Structures. 2 Objectives F To describe what a data structure is (§17.1). F To explain the limitations of arrays (§17.1).
מרצה: יהודה אפק מגיש: ערן שרגיאן. OutlineOutline Quick reminder of the Stack structure. The Unbounded Lock-Free Stack. The Elimination Backoff Stack.
Stack Overview. Stack Stack ADT Basic operations of stack – Pushing, popping etc. Implementations of stacks using – array – linked list.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Review of Stacks and Queues Dr. Yingwu Zhu. How does a Stack Work? Last-in-First-out (LIFO) data structure Adding an item Push operation Removing an item.
Kovács Zita 2014/2015. II. félév DATA STRUCTURES AND ALGORITHMS 26 February 2015, Linked list.
Linked List by Chapter 5 Linked List by
COSC 1P03 Data Structures and Abstraction 5.1 Linear Linked Structures A bank is a place where they lend you an umbrella in fair weather and ask for it.
Data Structures. Abstract Data Type A collection of related data is known as an abstract data type (ADT) Data Structure = ADT + Collection of functions.
Chapter 5 Linked List by Before you learn Linked List 3 rd level of Data Structures Intermediate Level of Understanding for C++ Please.
SkipLists and Balanced Search The Art Of MultiProcessor Programming Maurice Herlihy & Nir Shavit Chapter 14 Avi Kozokin.
Data Structures David Kauchak cs302 Spring Data Structures What is a data structure? Way of storing data that facilitates particular operations.
DECS: A Dynamic Elimination-Combining Stack Algorithm Gal Bar-Nissan, Danny Hendler, Adi Suissa 1 OPODIS 2011.
Shared Counters and Parallelism Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
Spring 2008 Mark Fontenot CSE Honors Principles of Computer Science I Note Set 15 1.
Lecture 10 b Stacks b Queues. 2 Stacks b A stack ADT is linear b Items are added and removed from only one end of a stack b It is therefore LIFO: Last-In,
Distributed Algorithms (22903) Lecturer: Danny Hendler Lock-free stack algorithms.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
Review Array Array Elements Accessing array elements
Data Structure By Amee Trivedi.
Stacks and Queues Chapter 4.
Lectures linked lists Chapter 6 of textbook
Program based on queue & their operations for an application
Data Structure Interview Question and Answers
Background on the need for Synchronization
Objectives In this lesson, you will learn to: Define stacks
Sequences 8/2/ :13 AM Linked Lists Linked Lists.
Stacks and Queues.
Data Structures Interview / VIVA Questions and Answers
Stack and Queue APURBO DATTA.
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Data Structure Interview
A Lock-Free Algorithm for Concurrent Bags
Distributed Algorithms (22903)
Anders Gidenstam Håkan Sundell Philippas Tsigas
Distributed Algorithms (22903)
Arrays and Linked Lists
Sequences 11/27/2018 1:37 AM Singly Linked Lists Singly Linked Lists.
Sequences 12/8/2018 3:02 AM Linked Lists Linked Lists.
CSC 1052 Stacks 1/11/2019.
Introduction to C++ Linear Linked Lists
CSE 451 Section 1/27/2000.
Lecture 18: Coherence and Synchronization
Presentation transcript:

Scalable Flat-Combining Based Synchronous Queues Danny Hendler, Itai Incze, Nir Shavit and Moran Tzafrir Presentation by Uri Golani

Overview Synchronous queue Synchronous queue using single combiner flat combining Synchronous queue using Parallel flat combining Benchmarks

Overview Synchronous queue Synchronous queue using single combiner flat combining Synchronous queue using Parallel flat combining Benchmarks

Synchronous queue Suited for Handoff designs Each put must wait for a get and vice verca. No capacity Does not permit null elements Does not impose order (unfair)

Overview Synchronous queue Synchronous queue using single combiner flat combining Synchronous queue using Parallel flat combining Benchmarks

So what is flat combining? It means that all requests are laid on a sequential data structure and are combined by traversing it.

F.C Algorithms Attributes: Publication record – per thread Publication list Global lock Private stack Count

A Threads Publication Record : Requ est Item Publication Record Is linked

Publication list A list of containing a static head and publication records A thread has at most one P.R in the list Adding a P.R to the list involves a CAS to the head of the list. Removing P.R doesnt include CAS therefore head.next will never be removed.

Global lock Enables one thread only to traverse the publication list and act as a combiner Publication records can still be added to the publication list even when the lock is taken.

Counter When grabbing the lock and becoming a combiner a thread increments this field. Every predefined number of increments a clean up of old requests from the publication list takes place

Private stack A construct member. Not issued per combiner Stores Push/Pop operations during the traversal of the combiner Keeps the overflow of requests for the next combining rounds

FC Synchronous queue – get/put methods 1.Allocate a publication Record if it is null 2.while(true) 2.1 check that P.R is still active and in the publication list. CAS it to the head of the publication list otherwise. 2.2 try to acquire the lock (CAS) to become combiner and Combine() if succeeded 2.3 check If the publication records item is not null, if so, break.

Combine() 1. increment count 2. for (COMBINING_ROUND) 2.1 traverse the publication list combining complimentary requests. Pushing overflows into the stack 2.2 if (count % CLEAN_UP = 0) remove old P.R

Single Combiner Overlay : Requ est Item Requ est Item Requ est Item Requ est Item 3. Combiner traverses list collecting requests into stack and matching them to other requests along the list Hea d Cou nt Thread C Thread A Thread B Thread D 4. infrequently, new records are CASed by threads to head of list, and old ones are removed by combiner 2. thread acquires lock, becomes combiner, updates count Combiners private stack publicatio n list 1. thread writes push or pop request and spins on local record Push Po p Pu sh

Overview Synchronous queue Synchronous queue using single combiner flat combining Synchronous queue using Parallel flat combining Benchmarks

Parallel flat combining Uses two levels of combining: 1.Dynamic level – Multiple combiners working in parallel 2.Exchange level – Combining overflows of the dynamic level in a single combiner form

Dynamic level Publication list is divided to sub lists of limited size Each sub list is issued a combiner node head, has its own lock, and private stack Multiple combiners can work on the sub lists, and thus the work on the publication list is done in parallel

Exchange level Has a publication list, private stack and lock Each publication record represents one sub list in the dynamic level Publication records item consists of a list of overflow requests (gets/puts) from the dynamic level Combining is done using a single combiner

Parallel Combiner Overlay: Reques t Item Reques t Item Reques t Item Reques t Item Reques t Item Reques t Item 1 st combiner node Reques t Item Threa d C Combiner Node Threa d A Reques t Item Thread G Reques t Item Threa d B Reques t Item Thread D Reques t Item Threa d E Combiner Node 2 nd combiner node 3 rd combiner node Combiner Node Coun t privat e stack Coun t privat e stack Head of the dynamic FC publication list 2 nd combiner Reques t Item 3 rd combiner Reques t Item 1 st combiner Reques t Item Head of the exchange FC publication list Cou nt privat e stack Reques t overflo ws

Is parllel flat combining linearizable? Operations can be linearized at the point of release of the first of two combined requests. It can be viewed as an object whose history is made of a sequence of pairs consisting of a push followed by a pop (i.e. push, pop, push, pop...) Well, it is.

Overview Synchronous queue Synchronous queue using single combiner flat combining Synchronous queue using Parallel flat combining Benchmarks

Pitfalls of parallel flat combining: Performance is highly based on the balance of requests type on the various sub lists