CS510 Concurrent Systems Tyler Fetters. A Methodology for Implementing Highly Concurrent Data Objects.

Slides:



Advertisements
Similar presentations
Stacks, Queues, and Linked Lists
Advertisements

Fast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems Håkan Sundell Philippas Tsigas.
CAFÉ: Scalable Task Pool with Adjustable Fairness and Contention Dmitry Basin, Rui Fan, Idit Keidar, Ofer Kiselov, Dmitri Perelman Technion, Israel Institute.
Wait-Free Queues with Multiple Enqueuers and Dequeuers
Synchronization. How to synchronize processes? – Need to protect access to shared data to avoid problems like race conditions – Typical example: Updating.
1 Chapter 4 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
CS510 – Advanced Operating Systems 1 The Synergy Between Non-blocking Synchronization and Operating System Structure By Michael Greenwald and David Cheriton.
Wait-Free Reference Counting and Memory Management Håkan Sundell, Ph.D.
CPSC 668Set 18: Wait-Free Simulations Beyond Registers1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Circular Linked List. Agenda  What is a Circularly linked list  Why a Circular Linked List  Adding node in a new list  Adding node to list with nodes.
Data Structures: A Pseudocode Approach with C
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
“THREADS CANNOT BE IMPLEMENTED AS A LIBRARY” HANS-J. BOEHM, HP LABS Presented by Seema Saijpaul CS-510.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
Computer Laboratory Practical non-blocking data structures Tim Harris Computer Laboratory.
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.
Memory Management A memory manager should take care of allocating memory when needed by programs release memory that is no longer used to the heap. Memory.
Language Support for Lightweight transactions Tim Harris & Keir Fraser Presented by Narayanan Sundaram 04/28/2008.
Synchronization in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
SUPPORTING LOCK-FREE COMPOSITION OF CONCURRENT DATA OBJECTS Daniel Cederman and Philippas Tsigas.
1 Lock-Free Linked Lists Using Compare-and-Swap by John Valois Speaker’s Name: Talk Title: Larry Bush.
Practical and Lock-Free Doubly Linked Lists Håkan Sundell Philippas Tsigas.
Software Transactional Memory for Dynamic-Sized Data Structures Maurice Herlihy, Victor Luchangco, Mark Moir, William Scherer Presented by: Gokul Soundararajan.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 18: Wait-Free Simulations Beyond Registers 1.
November 15, 2007 A Java Implementation of a Lock- Free Concurrent Priority Queue Bart Verzijlenberg.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Mutual Exclusion.
CSC321 Concurrent Programming: §5 Monitors 1 Section 5 Monitors.
JAVA MEMORY MODEL AND ITS IMPLICATIONS Srikanth Seshadri
Transactional Memory Lecturer: Danny Hendler. 2 2 From the New York Times…
A Methodology for Creating Fast Wait-Free Data Structures Alex Koganand Erez Petrank Computer Science Technion, Israel.
Non-Blocking Concurrent Data Objects With Abstract Concurrency By Jack Pribble Based on, “A Methodology for Implementing Highly Concurrent Data Objects,”
Wait-Free Multi-Word Compare- And-Swap using Greedy Helping and Grabbing Håkan Sundell PDPTA 2009.
Practical concurrent algorithms Mihai Letia Concurrent Algorithms 2012 Distributed Programming Laboratory Slides by Aleksandar Dragojevic.
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.
1 Algorithms Queues, Stacks and Records stored in Linked Lists or Arrays.
A Methodology for Implementing Highly Concurrent Data Objects by Maurice Herlihy Slides by Vincent Rayappa.
November 27, 2007 Verification of a Concurrent Priority Queue Bart Verzijlenberg.
Distributed Algorithms (22903) Lecturer: Danny Hendler The wait-free hierarchy and the universality of consensus This presentation is based on the book.
2005MEE Software Engineering Lecture 7 –Stacks, Queues.
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,
Scalable lock-free Stack Algorithm Wael Yehia York University February 8, 2010.
Distributed Algorithms (22903) Lecturer: Danny Hendler Lock-free stack algorithms.
Distributed Algorithms (22903)
CC 215 Data Structures Queue ADT
Håkan Sundell Philippas Tsigas
Department of Computer Science, University of Rochester
Distributed Algorithms (22903)
Distributed Algorithms (22903)
CS510 Concurrent Systems Jonathan Walpole.
Distributed Algorithms (22903)
Pointers and Linked Lists
CS510 Concurrent Systems Jonathan Walpole.
A Methodology for Implementing Highly Concurrent Data Objects
CS510 - Portland State University
Multicore programming
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Software Transactional Memory Should Not be Obstruction-Free
A Concurrent Lock-Free Priority Queue for Multi-Thread Systems
Multicore programming
CS510 Advanced Topics in Concurrency
ECE 103 Engineering Programming Chapter 63 Queue Implementation
CS510 Concurrent Systems Jonathan Walpole.
CSCS-200 Data Structure and Algorithms
More concurrency issues
Presentation transcript:

CS510 Concurrent Systems Tyler Fetters

A Methodology for Implementing Highly Concurrent Data Objects

Agenda Definitions Author Biography Overview Small Objects Class Exercise Large Objects Summary & Contributions

Definitions Non-Blocking Wait-Free Concurrent Objects load_linked (LL) store_conditional (SC) Small Object Large Object Linearizable

Author Biography Ph.D. in CS from MIT Professor: Carnegie Mellon University Brown University Awards: 2003 & 2012 Dijkstra Prize 2004 Godel Prize 2013 W. Wallace McDowell Award

Overview Provide a framework for transforming sequential data structures into concurrent ones Requires writing operations as stylized sequential operations Increase ease of reasoning Uses LL and SC as core primitives (said to be “universal”, in terms of their ability to reach consensus in a wait-free manner for a unlimited number of threads)

Overview Cont. Implement data objects as stylized sequential programs without explicit synchronization* Apply synchronization and memory management techniques This transformation will “in theory” transform any sequential object into a non-blocking or wait-free concurrent object.

Overview Cont. Linearizability is used as a basic correctness of the implementation This doesn’t mean a concurrent version which allows other values to occur is incorrect. Thus, non-linearizable algorithm are not necessarily incorrect.

Small Objects At a high level: Reads memory pointer using load_linked Copies version into another block Applies sequential operation to the copy Calls store_conditional to swing the pointer from the old to the new On success transformation complete On failure retry

Small Objects Cont. - Code int Pqueue_deq(Pqueue_type **Q){... while(1){ old_pqueue = load_linked(Q); old_version = &old_pqueue->version; new_version = &new_pqueue->version; first = old_pqueue->check[1]; copy(old_version, new_version); last = old_pqueue->check[0]; if (first == last){ result = pqueue_deq(new_version); if (store_conditional(Q, new_version))break; } new_pqueue = old_pqueue; return result; } Preventing the race condition! Copy the old, new data. If the check values do not match, loop again. We failed. If the check values DO match, now we can perform our dequeue operation! Try to publicize the new heap via store_conditional, which could fail and we loop back. Lastly, copy the old concurrent object pointer to the new concurrent pointer. Return our priority queue result.

Small Objects Cont. – Back Off... if (first == last) { result = pqueue_deq(new_version); if (store_conditional(Q, new_version )) break; } if (max_delay < DELAY_LIMIT) max_delay = 2 * max_delay; delay = random() % max_delay; for (i = 0; i < delay; i++); } /* end while*/ new_pqueue = old_pqueue; return result; } When the consistency check or the store_conditional fails, introduce back-off for a random amount of time!

Small Objects Cont. - Performance Small Object, Non-Blocking (back-off) Small Object, Non-Blocking (naive)

Small Objects Cont. – Wait Free Operation combining – before trying to do work to the concurrent object, a thread records what it is trying to do. Then reads what all other threads are doing and tries to complete the work for them Once it does all of their work it then does it’s own. Gain failure tolerance at the cost of efficiency.

Small Objects Cont. – Wait Free Use Operation combining to transform the block-free object into a wait free Process starts an operation. Record the call in Invocation. Upon completion of the operation, record the result in Result.

... announce[P].op_name = DEQ_CODE; new_toggle = announce[P].toggle = !announce[P].toggle; if (max_delay> 1) max_delay = max_delay >> 1; while(((*Q)->responses[P].toggle != new_toggle) || ((*Q)->responses[P].toggle != new_toggle)){ old_pqueue = load_linked(Q); old_version = &old_pqueue->version; new_version = &new_pqueue->version; first = old_pqueue->check[1]; memcopy(old_version, new_version, sizeof(pqueue_type)); last = old_pqueue->check[0]; if (first == last){ result = pqueue_deq(new_version); apply(announce, Q); if (store_conditional(Q, new_version )) break; } if (max_delay < DELAY_LIMIT) max_delay = 2 * max_delay; delay = random() % max_delay; for (i = 0; i < delay; i++); } new_pqueue = old_pqueue; return result; } Small Objects Cont. – Wait Free Record the process name. Flip the toggle bit. apply pending operations to the NEW version.

Small Objects Cont. – Wait Free Small Object, Non-Blocking (back-off) Small Object, Wait Free (back- off)

Class Exercise Sequential Code for Removing Head node to the head of a Linked List Apply synchronization and memory management techniques Add Exponential Back-off for performance

Typedef Res { boolean non_empty; int ret_val; } Res linkList_removeHead(LinkList_type * l){ node * temp; Res value; value->non_empty = false if (l->head != null) { value->non_empty = true; temp = l->head->next; value->ret_value = head->value; head = temp; } return value; } Class Exercise

Res LinkList_removeHead(LinkList_type **L){... while(1){ old_linkList = load_linked(L); old_version = &old_linkList->version; new_version = &new_linkList->version; first = old_linkList->check[1]; copy(old_version, new_version); last = old_linkList->check[0]; if (first == last){ result = linkList_removeHead(new_version); if (store_conditional(L, new_version))break; } if (max_delay < DELAY_LIMIT) max_delay = 2 * max_delay; delay = random() % max_delay; for (i = 0; i < delay; i++); } new_linkList = old_linkList; return result; }

Large Objects Per-process pool of memory 3 states: committed, allocated and freed Operations: set_alloc moves block from committed (freed?) to allocated and returns address set_free moves block to freed set_prepare marks blocks in allocated as consistent set_commit sets committed to union of freed and committed set_abort sets freed and allocated to the empty set

Summary & Contributions Foundation for transforming sequential implementations (small and large) to concurrent operations Possible to be performed by a compiler Maintains a “reasonable” level of performance Utilizing LL and SC as base primitives Addresses the issue of conceptual complexity (thoughts?)

Sources A Methodology for Implementing Highly Concurrent Data Objects – Slides from Tina Swenson –