Scalable lock-free Stack Algorithm

Slides:



Advertisements
Similar presentations
Hongjin Liang and Xinyu Feng
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.
Liveness and Performance Issues
Scalable and Lock-Free Concurrent Dictionaries
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Memory Management & Method Calls in Java Program Execution © Allan C. Milne v
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
CS533 Concepts of Operating Systems Class 3 Integrated Task and Stack Management.
30-Jun-15 Stacks. What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything.
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
A Dynamic Elimination-Combining Stack Algorithm Gal Bar-Nissan, Danny Hendler and Adi Suissa Department of Computer Science, BGU, January 2011 Presnted.
224 3/30/98 CSE 143 Recursion [Sections 6.1, ]
Verification of obstruction-free algorithm with contention management Niloufar Shafiei.
מרצה: יהודה אפק מגיש: ערן שרגיאן. OutlineOutline Quick reminder of the Stack structure. The Unbounded Lock-Free Stack. The Elimination Backoff Stack.
A Methodology for Creating Fast Wait-Free Data Structures Alex Koganand Erez Petrank Computer Science Technion, Israel.
Access Modifiers Control which classes use a feature Only class-level variables may be controlled by access modifiers Modifiers 1. public 2. protected.
Concurrent Stacks Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
Computer Engineering Rabie A. Ramadan Lecture 6.
DECS: A Dynamic Elimination-Combining Stack Algorithm Gal Bar-Nissan, Danny Hendler, Adi Suissa 1 OPODIS 2011.
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
1 Critical Section Problem CIS 450 Winter 2003 Professor Jinhua Guo.
Distributed Algorithms (22903) Lecturer: Danny Hendler Lock-free stack algorithms.
CSC 143 P 1 CSC 143 Recursion [Chapter 5]. CSC 143 P 2 Recursion  A recursive definition is one which is defined in terms of itself  Example:  Compound.
递归算法的效率分析. When a function is called... A transfer of control occurs from the calling block to the code of the function --It is necessary that there be.
STACKS & QUEUES for CLASS XII ( C++).
Functions.
Håkan Sundell Philippas Tsigas
Compositional Pointer and Escape Analysis for Java Programs
Multicore Programming Final Review
Faster Data Structures in Transactional Memory using Three Paths
Reactive Synchronization Algorithms for Multiprocessors
Stacks and Queues.
Distributed Algorithms (22903)
Systems Programming 3rd laboratory Test_driven Development
Distributed Algorithms (22903)
Distributed Algorithms (22903)
In this lecture Global variables Local variables System stack
COMPUTER 2430 Object Oriented Programming and Data Structures I
Non-blocking data structures and transactional memory
Distributed Algorithms (22903)
STACK By:- Rajendra ShakyawalP.G.T. Computer Science KV-No.1, AFS, Tambaram, Chennai.
CS510 Concurrent Systems Jonathan Walpole.
Designing Parallel Algorithms (Synchronization)
Chapter 18-3 Recursion Dale/Weems.
תגבור פרונטלי 6 ברוכים הבאים מבוא למדעי המחשב 2018
Recursion Data Structures.
Stacks and Queues.
ITEC 2620M Introduction to Data Structures
Multicore programming
Thread Synchronization
Lecture: Coherence and Synchronization
Critical section problem
Multicore programming
Model Checking of a lock-free stack
CS533 Concepts of Operating Systems
When a function is called...
EE 312 Exam I Review.
CS510 Concurrent Systems Jonathan Walpole.
UNIT-II.
… NPDAs continued.
Lecture: Coherence and Synchronization
STACK DATA Expert Arena ea STACK LIFO ( Stack rule) PUSH (function)
CSE 332: Concurrency and Locks
EE 312 Exam I Review.
CSc 453 Interpreters & Interpretation
Process/Thread Synchronization (Part 2)
Stacks.
Data Structures.
Normal Forms for Context-free Grammars
EE 312 Exam I Review.
Presentation transcript:

Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010

A scalable lock-free stack algorithm To reduce contention on the stack (i.e. on the top pointer) we used: Elimination as a Backoff mechanism Example: t1: push(3), t2: pop(), t3: push(1), t4: push(2) All but t4 fail to modify the top pointer So they try to collide: Stack t4 push(2) top top 2 t1, t2, t3 backoff 5 5 t1 t2 t3 1 Collision Array 1

Implementation The algorithm is non-blocking so no locks 4 classes created stack<T> AtomicReference<cell<T>> top T pop(threadInfo<T> p) void push(T value, threadInfo<T> p) StackThread threadInfo<T> info threadInfo<T> final int id final int spin OP op cell<T> cell cell<T> cell<T> next T value

Key variables We have three shared variables: two arrays used during collision: void * location[] - for data exchange and synch java.util.concurrent.atomic.AtomicReferenceArray int collision[] - for finding a collision partner java.util.concurrent.atomic.AtomicIntegerArray one top pointer: Cell * top - points to the top of the stack java.util.concurrent.atomic.AtomicReference

Correctness Tests Tested for correctness by: Counting the number of pushes, pops and failed pops Compare the expected stack size to the actual size So far all expected == actual

Timing tests Ran the stack under different number of threads and total operations Compared to Treiber’s stack (the one discussed in class) Ours ran 2-3 times faster. The rate increased as # of threads increased

Our stack vs Treiber’s

Possible improvement and the next step Will test against: improved implementations of our stack algorithm synchronized stack Try to prove some properties of our algorithm