Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao.

Slides:



Advertisements
Similar presentations
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Advertisements

Operating Systems Part III: Process Management (Process Synchronization)
1 Chapter 5 Concurrency: Mutual Exclusion and Synchronization Principals of Concurrency Mutual Exclusion: Hardware Support Semaphores Readers/Writers Problem.
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Architecture-aware Analysis of Concurrent Software Rajeev Alur University of Pennsylvania Amir Pnueli Memorial Symposium New York University, May 2010.
Chapter 6: Process Synchronization
5.1 Silberschatz, Galvin and Gagne ©2009 Operating System Concepts with Java – 8 th Edition Chapter 5: CPU Scheduling.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Process Synchronization. Module 6: Process Synchronization Background The Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores.
Maged M. Michael, “Hazard Pointers: Safe Memory Reclamation for Lock- Free Objects” Presentation Robert T. Bauer.
Scalable and Lock-Free Concurrent Dictionaries
Wait-Free Reference Counting and Memory Management Håkan Sundell, Ph.D.
Håkan Sundell, Chalmers University of Technology 1 Space Efficient Wait-free Buffer Sharing in Multiprocessor Real-time Systems Based.
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.
Concurrent Data Structures in Architectures with Limited Shared Memory Support Ivan Walulya Yiannis Nikolakopoulos Marina Papatriantafilou Philippas Tsigas.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
1 Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
Chapter 6: Process Synchronization. Outline Background Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores Classic Problems.
CS510 Advanced OS Seminar Class 10 A Methodology for Implementing Highly Concurrent Data Objects by Maurice Herlihy.
Simple, Fast, and Practical Non- Blocking and Blocking Concurrent Queue Algorithms Presenter: Jim Santmyer By: Maged M. Micheal Michael L. Scott Department.
CS510 Concurrent Systems Class 2 A Lock-Free Multiprocessor OS Kernel.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
Simple, Fast and Practical Non- Blocking and Blocking Concurrent Queue Algorithms Maged M. Michael & Michael L. Scott Presented by Ahmed Badran.
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
Operating Systems CSE 411 CPU Management Oct Lecture 13 Instructor: Bhuvan Urgaonkar.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings 1.
Parallel Programming Philippas Tsigas Chalmers University of Technology Computer Science and Engineering Department © Philippas Tsigas.
Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago.
CS510 Concurrent Systems Jonathan Walpole. A Lock-Free Multiprocessor OS Kernel.
Håkan Sundell, Chalmers University of Technology 1 Using Timing Information on Wait-Free Algorithms in Real-Time Systems (2 papers)
Concurrency, Mutual Exclusion and Synchronization.
Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Dave Bremer Otago Polytechnic,
Concurrency: Mutual Exclusion and Synchronization Chapter 5.
Håkan Sundell, Chalmers University of Technology 1 NOBLE: A Non-Blocking Inter-Process Communication Library Håkan Sundell Philippas.
November 15, 2007 A Java Implementation of a Lock- Free Concurrent Priority Queue Bart Verzijlenberg.
Håkan Sundell, Chalmers University of Technology 1 Simple and Fast Wait-Free Snapshots for Real-Time Systems Håkan Sundell Philippas.
A Consistency Framework for Iteration Operations in Concurrent Data Structures Yiannis Nikolakopoulos A. Gidenstam M. Papatriantafilou P. Tsigas Distributed.
Challenges in Non-Blocking Synchronization Håkan Sundell, Ph.D. Guest seminar at Department of Computer Science, University of Tromsö, Norway, 8 Dec 2005.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
CSE 425: Concurrency II Semaphores and Mutexes Can avoid bad inter-leavings by acquiring locks –Guard access to a shared resource to take turns using it.
Executing Parallel Programs with Potential Bottlenecks Efficiently Yoshihiro Oyama Kenjiro Taura Akinori Yonezawa {oyama, tau,
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects Maged M. Michael Presented by Abdulai Sei.
The read-copy-update mechanism for supporting real-time applications on shared-memory multiprocessor systems with Linux Guniguntala et al.
CS510 Concurrent Systems Jonathan Walpole. A Methodology for Implementing Highly Concurrent Data Objects.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-5 Process Synchronization Department of Computer Science and Software.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Operating System Chapter 5. Concurrency: Mutual Exclusion and Synchronization Lynn Choi School of Electrical Engineering.
Hazard Pointers: Safe Memory Reclamation for Lock-Free Objects MAGED M. MICHAEL PRESENTED BY NURIT MOSCOVICI ADVANCED TOPICS IN CONCURRENT PROGRAMMING,
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 6: Process Synchronization.
Scalable Computing model : Lock free protocol By Peeyush Agrawal 2010MCS3469 Guided By Dr. Kolin Paul.
Chapter 5 Concurrency: Mutual Exclusion and Synchronization Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee.
Håkan Sundell Philippas Tsigas
Department of Computer Science, University of Rochester
Chapter 5: Process Synchronization
Challenges in Concurrent Computing
Chapter 5: Process Synchronization
Topic 6 (Textbook - Chapter 5) Process Synchronization
Module 7a: Classic Synchronization
Yiannis Nikolakopoulos
Concurrency: Mutual Exclusion and Process Synchronization
Chapter 6: Synchronization Tools
Process/Thread Synchronization (Part 2)
Chapter 5 Mutual Exclusion(互斥) and Synchronization(同步)
Presentation transcript:

Maged M.Michael Michael L.Scott Department of Computer Science Univeristy of Rochester Presented by: Jun Miao

Outline Introduction Related work 2-lock FIFO queue algorithm Non-blocking FIFO queue algorithm Experiment Conclusion Advantages and Disadvantages

Introduction FIFO queue: A linked list of items with two interface methods, namely, enqueue and dequeue. Problem: How to make enqueues and dequeues work concurrently and correctly on a shared FIFO queue

Some Definitions Wait-free All threads or processes can make progress in finite steps Non-blocking Some threads or processes are guaranteed to make progress in finite steps Obstruction-free One thread or process is guaranteed to make progress in finite steps Lock-free No deadlock or Not using locks?

Methods Blocking: utilizes locks to prevent conflicts between competing processes and threads Most significant feature: Slow processes and threads may block fast ones Non-Blocking: ensures that threads competing for a shared resource do not have their execution indefinitely postponed by mutex or semaphore.

Related Work Hwang and Briggs[1984], Sites[1980] and Stones[1990] present lock-free algorithms based on compare_and_swap. Gottlieb et al.[1983] and Mellor-Crummey[1987] present algorithms that are lock-free but not non- blocking. Prakash, Lee and Johnson[1991,1994] present a non- blocking algorithm by taking snapshots of the queue Valois[1994,1995] presents a list-based non-blocking algorithm.

The FIFO queue Head: always point to the last dequeued point Tail: Should point to the last node in the queue The only inconsistent condition: a new node is enqueued as the last node, but Tail is not updated to point to it.

2-Lock concurrent FIFO queue algorithm Enqueue operation Last enqueued Node Node3Node2Node1 Head Tail T_lock Thread 1 Enqueue operation Node4 Thread 2 Enqueue operation Node 5 Thread 3 Enqueue operation Node 6 Compete for the T_lock mutex

2-Lock concurrent FIFO queue algorithm(Cont’d) Dequeue operation Last enqueued Node Node3Node2Node1 Head Tail Thread 1 Dnqueue operation Thread 2 Dnqueue operation Thread 3 Dnqueue operation Compete for the H_lock mutex

2-Lock concurrent FIFO queue algorithm (Cont’d)

Compare And Swap A special instruction that atomically compares the contents of a memory location to a given value and, if they are the same, modifies the contents of that memory location to a given new value. C code of CAS: int compare_and_swap (int *word, int testval, int newval) { int oldval; oldval = *word; if (oldval == testval) *word = newval; return oldval; }

ABA Problem ABA problem is the enemy of non-blocking algorithm using CAS primitive. Value: A A shared memory whose address is ADDR Initially Thread t1: get ADDR and A

ABA Problem(Cont’d) Next Finally Value: A A shared memory whose address is ADDR Thread t2: Change Value from A to B, and then back to A Value: A A shared memory whose address is ADDR Thread t1: CAS(&ADDR, A, newValue)

Solution Associate a counter with each block of memory If the node changes, counter++ Compare not only the value in the address, but also the counters when using CAS

Non-blocking FIFO queue algorithm

Non-blocking FIFO queue algorithm(Cont’d)

For a non-blocking algorithm, every CAS primitive will be executed only after step-by- step checks. Try to split the procedure into atomic operations to detect every interleaves

Experiment Work on 12-processor Silicon Graphics Challenge multiprocessor Associate each processes with each processors Totally 100,000 pairs enqueue and dequeue operation. 100,000/n on each processor. n is the number of processors being used.

Result

Conclusion The concurrent non-blocking queue algorithm that is simple, practical, and fast. It is the choice of any queue-based application on a multiprocessor with universal atomic primitives. The 2-lock is recommended to heavily-utilized queues on machines with simple atomic primitives.

Advantages Blocking  Easy to implement  Can be used universally Non-blocking  High efficiency  Never deadlock  Ensures the priority of fast threads

Disadvantages Blocking  allows slow threads blocking fast threads  Deadlock may happen  Starvation Non-blocking  Hard to design  depend on what atomic primitives can be provided by systems  ABA problem is a potential danger for those who use CAS primitive  Cannot completely avoid starvation

Question time