Lindsay Groves, Simon Doherty. Mark Moir, Victor Luchangco
|
|
- Dorthy Johnson
- 5 years ago
- Views:
Transcription
1 Lindsay Groves, Simon Doherty Victoria University of Wellington Mark Moir, Victor Luchangco Sun Microsystems, Boston (FORTE, Madrid, September, 2004)
2 Lock-based concurrency doesn t scale Lock-free/non-blocking offer better performance, but are very subtle! Michael & Scott s queue Techniques for verification Simulation between automata Model checking After a finite number of steps, some operation completes FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 2
3 Prepare for operation Observe shared variables Work with locals Attempt to update Update if not changed since last read Needs strong synchronisation primitive If unsuccessful, try again FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 3
4 Prepare for operation Observe shared variables Work with locals Attempt to update Update if not changed since last read Needs strong synchronisation primitive If unsuccessful, try again FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 4
5 Prepare for operation Observe shared variables Work with locals Attempt to update Update if not changed since last read Needs strong synchronisation primitive If unsuccessful, try again FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 5
6 ! Load Linked/Store Conditional (LL/SC) LL: Load value SC: Update if not changed since LL Implementations limited Compare and Swap (CAS) Update if location contains expected value Doesn t guarantee value hasn t changed! Use version numbers to get around this ABA FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 6
7 " # boolean CAS(add, old, new) { atomically { if ( add* == old ) { add* = new; return true; } else return false; } } FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 7
8 Head Tail Head Dummy node Tail FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 8
9 $% Create and initialise new node: Head Tail FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 9
10 $% Append new node onto list: Head Tail FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 10
11 $% Swing Tail to point to new node: Head Tail FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 11
12 &% If HeadTail, copy value from second node: Head Tail Result: a FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 12
13 &% Swing Head to second node: Head Tail Result: a FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 13
14 &% Unlink old header node and release: Head Tail Result: a FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 14
15 % Declarations: node = {Data val; node* next}; node* Head, Tail; Initialisation: Head = Tail = new(node); Head->next = null; FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 15
16 % void Enqueue(data v) { node n = new(node); n->val = v; n->next = null; Tail->next = n; Tail = n; } data Dequeue() { if (Head = Tail) return null; node h = Head; data v = h->next; Head = h->next; free(h); return v; } FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 16
17 " Enqueue can t update both Tail and Tail->next with single CAS. Append new code with CAS. Allow Tail to lag. Any enqueuer can advance Tail. Dequeuer has to consider Tail when queue is empty. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 17
18 " Tail can lag by at most one Head Tail Head Tail Special case for dequeue FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 18
19 "$% enqueue(value: data type) node = new_node(); node->value = value; node->next = NULL; loop tail = Tail; next = tail->next; if tail == Tail if next == NULL if CAS(&tail->next, next, node) break; else CAS(Tail, tail, next); endloop CAS(Tail, tail, node); FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 19
20 "$% enqueue(value: data type) node = new_node(); node->value = value; node->next = NULL; loop tail = Tail; next = tail->next; if tail == Tail if next == NULL if CAS(&tail->next, next, node) break; else CAS(Tail, tail, next); endloop CAS(Tail, tail, node); Allocate new node and initialise FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 20
21 "$% enqueue(value: data type) node = new_node(); node->value = value; node->next = NULL; loop tail = Tail; next = tail->next; if tail == Tail if next == NULL if CAS(&tail->next, next, node) break; else CAS(Tail, tail, next); endloop CAS(Tail, tail, node); Try to update Tail, till succeed FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 21
22 "$% enqueue(value: data type) node = new_node(); node->value = value; node->next = NULL; loop tail = Tail; next = tail->next; if tail == Tail if next == NULL if CAS(&tail->next, next, node) break; else CAS(Tail, tail, next); endloop CAS(Tail, tail, node); Try to update Tail, till succeed FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 22
23 "$% enqueue(value: data type) node = new_node(); node->value = value; node->next = NULL; loop tail = Tail; next = tail->next; if tail == Tail if next == NULL if CAS(&tail->next, next, node) break; else CAS(Tail, tail, next); endloop CAS(Tail, tail, node); Update Tail if it s trailing. Can be done at beginning, or by separate process. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 23
24 "&% dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; Keep trying till next = head->next; operation succeeds if head == Head if head == tail if (next == NULL) return FALSE; CAS(Tail, tail, next); else *pvalue = next->value; if CAS(Head, head, next) break; endloop free(head); return TRUE; FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 24
25 "&% dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; Return false if next = head->next; queue is empty if head == Head if head == tail if (next == NULL) return FALSE; CAS(Tail, tail, next); else *pvalue = next->value; if CAS(Head, head, next) break; endloop free(head); return TRUE; FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 25
26 "&% dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; next = head->next; if head == Head if head == tail if (next == NULL) return FALSE; CAS(Tail, tail, next); else *pvalue = next->value; if CAS(Head, head, next) break; endloop free(head); return TRUE; Update Tail if it s trailing FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 26
27 "&% dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; next = head->next; if head == Head if head == tail if (next == NULL) return FALSE; CAS(Tail, tail, next); else *pvalue = next->value; if CAS(Head, head, next) break; endloop free(head); return TRUE; Save node value to return FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 27
28 "&% dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; next = head->next; if head == Head if head == tail if (next == NULL) return FALSE; CAS(Tail, tail, next); else *pvalue = next->value; if CAS(Head, head, next) break; endloop free(head); return TRUE; Update Head if it hasn t change FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 28
29 "&% dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; next = head->next; if head == Head if head == tail if (next == NULL) return FALSE; CAS(Tail, tail, next); else *pvalue = next->value; if CAS(Head, head, next) break; endloop free(head); return TRUE; Release old header, and return TRUE FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 29
30 ' &! Can t release dequeued node to system another process may still have a pointer to it. Dequeue returns nodes to a free-list. Enqueue allocates nodes from the free-list if possible. Implementation is not population oblivious. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 30
31 ()* CAS doesn t guarantee that value hasn t changed - A B A. The rest of queue may be different. Attach version numbers to pointers and increment every time pointer is modified. Can store pointer and count in 64 bit word. Likelihood of mistake is minute. We assume version numbers unbounded! FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 31
32 $%#" enqueue(value: data type) node = new_node(); node->value = value; node->next.ptr = NULL; loop tail = Tail; next = tail.ptr->next; if tail == Tail Michael & Scott, if next.ptr == NULL 1996 if CAS(&tail.ptr->next, next, <node, next.count+1>) break; else CAS(Tail, tail, <next.ptr, tail.count+1>); endloop CAS(Tail, tail, <node, tail.count+1>); FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 32
33 &%#" dequeue(pvalue: pointer to data type): boolean loop head = Head; tail = Tail; next = head->next; if head == Head if head.ptr == tail.ptr if (next.ptr == NULL) return FALSE; CAS(Tail, tail, <next.ptr, tail.count+1>); else *pvalue = next.ptr->value; if CAS(Head, head, <next.ptr, head.count+1>) break; endloop free(head.ptr); return TRUE; FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 33
34 dequeue(pvalue: pointer to data type): boolean loop head = Head; next = head->next; if head == Head if (next.ptr == NULL) return FALSE; else *pvalue = next.ptr->value; if CAS(Head, head, <next.ptr, head.count+1>) tail = Tail; if head.ptr == tail.ptr CAS(Tail, tail, <next.ptr, tail.count+1>); break; endloop free(head.ptr); return TRUE; Only check special case after swinging Head successfully FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 34
35 For sequential implementation: Define function from representation to abstract queue values: f: List Queue Initial state represents empty queue: f(initlist) = emptyqueue Hoare, 1972 In general, may need relation, but function works here. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 35
36 +$% 1 a an, x a,...,a n enqueue 1,..., f f Enqueue Head Tail Head Tail a 1 a n a 1 a n x FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 36
37 +&% a,..., 1 a n dequeue(a 1 ) a 2,...,a n f Dequeue(a 1 ) f Head Tail Head Tail a 1 a n a 1 a n FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 37
38 For concurrent versions, must consider all possible interleavings of atomic actions. Prove linearisability: Every operation appears to occur at some point between its invocation and its response. Model specification and implementation as Input/Output Automata. Prove trace inclusion by simulation. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 38
39 *,*- External actions: enq_inv p (v) enq_resp p deq_inv p deq_res p (r) Internal actions: do_enq p do_deq p State variables: Abstract queue Updated by do_enq p and do_deq p Local variables Generates all linearisable executions FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 39
40 ","- External actions: As for Abstract Internal actions: One for each assignment Two for each test State variables: Heap model Local variables Generates all possible executions FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 40
41 Define simulation relation R between concrete and abstract IOA. Relates concrete and abstract values (cf f). Also relates pc values for both IOAs. Show that for every execution of ConcAut, there is an execution of AbsAut with the same trace (external actions). FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 41
42 Show that for every step of ConcAut there is a corresponding sequence of steps of AbsAut with the same trace: Match external actions. Identify point in ConcAut where operation takes effect (linearisation point), and match with internal action. Rest are stuttering steps. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 42
43 When dequeue observes Head in ConcAut, we can t tell whether the dequeue will return empty. Verification requires two steps: Forward simulation from ConcAut to IntAut. Backward simulation from IntAut to AbsAut. Intermediate automaton IntAut just handles dequeue on empty queue. FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 43
44 Michael & Scott, 1996 Prove several safety properties Note clear what they guarantee Yahva & Sagiv, 2003 Reduce to finite system and model check Check same properties as Michael and Scott Abrial & Cansell, 2004 Describe a formal construction Lecture slides only not clear what s done FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 44
45 $. Proofs of several algorithms: Stacks, queues and deques Array-based and pointer-based Using CAS and DCAS Manual and mechanical proofs (PVS) Errors found in two published algorithms Optimisation found for one Used SPIN to verify bugs and explore variants FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 45
46 /).0 Other algorithms Composition IOAs limited TLA maybe? Other theorem provers: HOL,... Model checking Good for initial testing and exploration Can abstraction give finite systems? FM in NZ, 27/7/04 A practical lock-free queue implementation and its verification 46
Parallelism and Data Synchronization
Project 5 Parallelism and Data Synchronization Out: In class on Tuesday, 10 Nov 2009 Due: 10am on Friday, 20 Nov 2009 In this project, you will be focusing on the theoretical side of parallelism and data
More informationCS510 Concurrent Systems. Jonathan Walpole
CS510 Concurrent Systems Jonathan Walpole Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms utline Background Non-Blocking Queue Algorithm Two Lock Concurrent Queue Algorithm
More informationVerifying Concurrent Data Structures by Simulation
Electronic Notes in Theoretical Computer Science 137 (2005) 93 110 www.elsevier.com/locate/entcs Verifying Concurrent Data Structures by Simulation Robert Colvin 1,2 Simon Doherty 3 Lindsay Groves 4 School
More informationNon-Blocking Algorithms and Preemption-Safe Locking on Multiprogrammed Shared Memory Multiprocessors
Non-Blocking Algorithms and Preemption-Safe Locking on Multiprogrammed Shared Memory Multiprocessors Maged M. Michael Michael L. Scott Department of Computer Science University of Rochester Rochester,
More informationNon-Blocking Algorithms and Preemption-Safe Locking on Multiprogrammed Shared Memory Multiprocessors
Non-Blocking Algorithms and Preemption-Safe Locking on Multiprogrammed Shared Memory Multiprocessors Maged M. Michael Michael L. Scott Department of Computer Science University of Rochester Rochester,
More informationNon-blocking Array-based Algorithms for Stacks and Queues!
Non-blocking Array-based Algorithms for Stacks and Queues! Niloufar Shafiei! Department of Computer Science and Engineering York University ICDCN 09 Outline! Introduction! Stack algorithm! Queue algorithm!
More informationA Non-Blocking Concurrent Queue Algorithm
A Non-Blocking Concurrent Queue Algorithm Bruno Didot bruno.didot@epfl.ch June 2012 Abstract This report presents a new non-blocking concurrent FIFO queue backed by an unrolled linked list. Enqueue and
More informationSimple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms
Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms Maged M. Michael Michael L. Scott Department of Computer Science University of Rochester Rochester, NY 14627-0226 fmichael,scottg@cs.rochester.edu
More informationFormal Verification of a Lazy Concurrent List-Based Set Algorithm
Formal Verification of a Lazy Concurrent List-Based Set Algorithm Robert Colvin 1, Lindsay Groves 2, Victor Luchangco 3, and Mark Moir 3 1 ARC Centre for Complex Systems, School of Information Technology
More informationLock-Free Techniques for Concurrent Access to Shared Objects
This is a revised version of the previously published paper. It includes a contribution from Shahar Frank who raised a problem with the fifo-pop algorithm. Revised version date: sept. 30 2003. Lock-Free
More informationNon-blocking Array-based Algorithms for Stacks and Queues. Niloufar Shafiei
Non-blocking Array-based Algorithms for Stacks and Queues Niloufar Shafiei Outline Introduction Concurrent stacks and queues Contributions New algorithms New algorithms using bounded counter values Correctness
More informationBringing Practical Lock-Free Synchronization to 64-Bit Applications
Bringing Practical Lock-Free Synchronization to 64-Bit Applications Simon Doherty School of Mathematical and Computing Sciences Victoria University Wellington, New Zealand simon.doherty@mcs.vuw.ac.nz Victor
More informationUnit 6: Indeterminate Computation
Unit 6: Indeterminate Computation Martha A. Kim October 6, 2013 Introduction Until now, we have considered parallelizations of sequential programs. The parallelizations were deemed safe if the parallel
More informationProving linearizability & lock-freedom
Proving linearizability & lock-freedom Viktor Vafeiadis MPI-SWS Michael & Scott non-blocking queue head tail X 1 3 2 null CAS compare & swap CAS (address, expectedvalue, newvalue) { atomic { if ( *address
More informationQuasi-Linearizability Relaxed Consistency For Improved Concurrency
TEL-AVIV UNIVERSITY RAYMOND AND BEVERLY SACKLER FACULTY OF EXACT SCIENCES SCHOOL OF COMPUTER SCIENCE Quasi-Linearizability Relaxed Consistency For Improved Concurrency Dissertation submitted in partial
More informationFIFO Queue Synchronization
FIFO Queue Synchronization by Moshe Hoffman A Thesis submitted for the degree Master of Computer Science Supervised by Professor Nir Shavit School of Computer Science Tel Aviv University July 2008 CONTENTS
More informationSimple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms. M.M. Michael and M.L. Scott. Technical Report 600 December 1995
Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms M.M. Michael and M.L. Scott Technical Report 600 December 1995 UNIVERSITY OF ROCHESTER COMPUTER SCIENCE 9960605 014 rroggtmo?rstäi
More informationCache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency
Cache-Aware Lock-Free Queues for Multiple Producers/Consumers and Weak Memory Consistency Anders Gidenstam Håkan Sundell Philippas Tsigas School of business and informatics University of Borås Distributed
More informationBQ: A Lock-Free Queue with Batching
BQ: A Lock-Free Queue with Batching Gal Milman Technion, Israel galy@cs.technion.ac.il Alex Kogan Oracle Labs, USA alex.kogan@oracle.com Yossi Lev Oracle Labs, USA levyossi@icloud.com ABSTRACT Victor Luchangco
More informationNON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 31 October 2012
NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 31 October 2012 Lecture 6 Linearizability Lock-free progress properties Queues Reducing contention Explicit memory management Linearizability
More informationHoare Logic and Model Checking
Hoare Logic and Model Checking Kasper Svendsen University of Cambridge CST Part II 2016/17 Acknowledgement: slides heavily based on previous versions by Mike Gordon and Alan Mycroft Introduction In the
More informationStatic Analysis of Atomicity for Algorithms Using Non-Blocking Synchronization
Static Analysis of Atomicity for Algorithms Using Non-Blocking Synchronization Liqiang Wang and Scott D. Stoller Abstract In concurrent programming, non-blocking synchronization is very efficient but difficult
More informationCS 134: Operating Systems
CS 134: Operating Systems Locks and Low-Level Synchronization CS 134: Operating Systems Locks and Low-Level Synchronization 1 / 25 2 / 25 Overview Overview Overview Low-Level Synchronization Non-Blocking
More informationHoare Logic and Model Checking. A proof system for Separation logic. Introduction. Separation Logic
Introduction Hoare Logic and Model Checking In the previous lecture we saw the informal concepts that Separation Logic is based on. Kasper Svendsen University of Cambridge CST Part II 2016/17 This lecture
More informationLock-Free and Practical Doubly Linked List-Based Deques using Single-Word Compare-And-Swap
Lock-Free and Practical Doubly Linked List-Based Deques using Single-Word Compare-And-Swap Håkan Sundell Philippas Tsigas OPODIS 2004: The 8th International Conference on Principles of Distributed Systems
More informationNon-Blocking Concurrent FIFO Queues With Single Word Synchronization Primitives
37th International Conference on Parallel Processing Non-Blocking Concurrent FIFO Queues With Single Word Synchronization Primitives Claude Evequoz University of Applied Sciences Western Switzerland 1400
More informationConcurrent Queues, Monitors, and the ABA problem. Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit
Concurrent Queues, Monitors, and the ABA problem Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Queues Often used as buffers between producers and consumers
More informationFine-grained synchronization & lock-free programming
Lecture 17: Fine-grained synchronization & lock-free programming Parallel Computer Architecture and Programming CMU 15-418/15-618, Spring 2016 Tunes Minnie the Moocher Robbie Williams (Swings Both Ways)
More informationFast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems
Fast and Lock-Free Concurrent Priority Queues for Multi-Thread Systems Håkan Sundell Philippas Tsigas Outline Synchronization Methods Priority Queues Concurrent Priority Queues Lock-Free Algorithm: Problems
More informationDCAS-Based Concurrent Deques
DCAS-Based Concurrent Deques Ole Agesen 1 David. Detlefs Christine H. Flood Alexander T. Garthwaite Paul A. Martin Mark Moir Nir N. Shavit 1 Guy. Steele Jr. VMware Tel Aviv University Sun Microsystems
More informationNON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 17 November 2017
NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 17 November 2017 Lecture 7 Linearizability Lock-free progress properties Hashtables and skip-lists Queues Reducing contention Explicit
More informationCS 241 Honors Concurrent Data Structures
CS 241 Honors Concurrent Data Structures Bhuvan Venkatesh University of Illinois Urbana Champaign March 27, 2018 CS 241 Course Staff (UIUC) Lock Free Data Structures March 27, 2018 1 / 43 What to go over
More informationLock-Free Concurrent Data Structures, CAS and the ABA-Problem
Lock-Free Concurrent Data Structures, CAS and the ABA-Problem 2 Motivation Today almost all PCs and Laptops have a multi-core ( e.g. quad-core ) processor Dr. Wolfgang Koch using SMP (symmetric multiprocessing)
More informationShape Predicates Allow Unbounded Verification of Linearizability Using Canonical Abstraction
Proceedings of the Thirty-Seventh Australasian Computer Science Conference (ACSC 2014), Auckland, New Zealand Shape Predicates Allow Unbounded Verification of Linearizability Using Canonical Abstraction
More informationFine-grained synchronization & lock-free data structures
Lecture 19: Fine-grained synchronization & lock-free data structures Parallel Computer Architecture and Programming Redo Exam statistics Example: a sorted linked list struct Node { int value; Node* next;
More informationChecking a Multithreaded Algorithm with + CAL
Checking a Multithreaded Algorithm with + CAL Leslie Lamport Microsoft Research 30 Jul 2006 To appear in DISC 2006 Abstract A colleague told me about a multithreaded algorithm that was later reported to
More informationAn Integrated Specification and Verification Technique for Highly Concurrent Data Structures
An Integrated Specification and Verification Technique for Highly Concurrent Data Structures Parosh Aziz Abdulla 1, Frédéric Haziza 1, Lukáš Holík 12, Bengt Jonsson 1, and Ahmed Rezine 3 1 Uppsala University,
More informationNON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY. Tim Harris, 21 November 2014
NON-BLOCKING DATA STRUCTURES AND TRANSACTIONAL MEMORY Tim Harris, 21 November 2014 Lecture 7 Linearizability Lock-free progress properties Queues Reducing contention Explicit memory management Linearizability
More information6.852: Distributed Algorithms Fall, Class 21
6.852: Distributed Algorithms Fall, 2009 Class 21 Today s plan Wait-free synchronization. The wait-free consensus hierarchy Universality of consensus Reading: [Herlihy, Wait-free synchronization] (Another
More informationProving liveness. Alexey Gotsman IMDEA Software Institute
Proving liveness Alexey Gotsman IMDEA Software Institute Safety properties Ensure bad things don t happen: - the program will not commit a memory safety fault - it will not release a lock it does not hold
More informationl Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises Chapters 1-7 + 11 Write C++ code to: l Determine if a number is odd or even CS 2308 Fall 2016 Jill Seaman l Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationLock free Algorithm for Multi-core architecture. SDY Corporation Hiromasa Kanda SDY
Lock free Algorithm for Multi-core architecture Corporation Hiromasa Kanda 1.Introduction Background needed Multi-Thread Problem of Multi-Thread program What's Lock free? Lock-free algorithm performance
More informationDesign of Concurrent and Distributed Data Structures
METIS Spring School, Agadir, Morocco, May 2015 Design of Concurrent and Distributed Data Structures Christoph Kirsch University of Salzburg Joint work with M. Dodds, A. Haas, T.A. Henzinger, A. Holzer,
More informationCS 1114: Implementing Search. Last time. ! Graph traversal. ! Two types of todo lists: ! Prof. Graeme Bailey.
CS 1114: Implementing Search! Prof. Graeme Bailey http://cs1114.cs.cornell.edu (notes modified from Noah Snavely, Spring 2009) Last time! Graph traversal 1 1 2 10 9 2 3 6 3 5 6 8 5 4 7 9 4 7 8 10! Two
More informationWhatever can go wrong will go wrong. attributed to Edward A. Murphy. Murphy was an optimist. authors of lock-free programs 3.
Whatever can go wrong will go wrong. attributed to Edward A. Murphy Murphy was an optimist. authors of lock-free programs 3. LOCK FREE KERNEL 309 Literature Maurice Herlihy and Nir Shavit. The Art of Multiprocessor
More information(6-1) Basics of a Queue. Instructor - Andrew S. O Fallon CptS 122 (September 26, 2018) Washington State University
(6-1) Basics of a Queue Instructor - Andrew S. O Fallon CptS 122 (September 26, 2018) Washington State University What is a Queue? 2 A linear data structure with a finite sequence of nodes, where nodes
More informationAtomic Variables & Nonblocking Synchronization
Atomic Variables & Nonblocking Synchronization CMSC 433 Fall 2014 Michael Hicks (with some slides due to Rance Cleaveland) A Locking Counter public final class Counter { private long value = 0; public
More information! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises Chapters 1-7 + 11 Write C++ code to:! Determine if a number is odd or even CS 2308 Fall 2018 Jill Seaman! Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More informationAST: scalable synchronization Supervisors guide 2002
AST: scalable synchronization Supervisors guide 00 tim.harris@cl.cam.ac.uk These are some notes about the topics that I intended the questions to draw on. Do let me know if you find the questions unclear
More informationIntroduction to Data Structures and Algorithms
Introduction to Data Structures and Algorithms Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective way. Data Structures
More informationWhatever can go wrong will go wrong. attributed to Edward A. Murphy. Murphy was an optimist. authors of lock-free programs LOCK FREE KERNEL
Whatever can go wrong will go wrong. attributed to Edward A. Murphy Murphy was an optimist. authors of lock-free programs LOCK FREE KERNEL 251 Literature Maurice Herlihy and Nir Shavit. The Art of Multiprocessor
More informationHoare logic. A proof system for separation logic. Introduction. Separation logic
Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.
More informationProgramming Language Seminar Concurrency 2: Lock-free algorithms
Programming Language Seminar Concurrency 2: Lock-free algorithms Peter Sestoft Friday 2013-11-01 1 Outline for today Compare-and-swap instruction Atomic test-then-set operation Implemented directly in
More informationPart 1: Concepts and Hardware- Based Approaches
Part 1: Concepts and Hardware- Based Approaches CS5204-Operating Systems Introduction Provide support for concurrent activity using transactionstyle semantics without explicit locking Avoids problems with
More information8. Fundamental Data Structures
172 8. Fundamental Data Structures Abstract data types stack, queue, implementation variants for linked lists, [Ottman/Widmayer, Kap. 1.5.1-1.5.2, Cormen et al, Kap. 10.1.-10.2] Abstract Data Types 173
More informationThe Relative Power of Synchronization Methods
Chapter 5 The Relative Power of Synchronization Methods So far, we have been addressing questions of the form: Given objects X and Y, is there a wait-free implementation of X from one or more instances
More informationLecture 21: Transactional Memory. Topics: consistency model recap, introduction to transactional memory
Lecture 21: Transactional Memory Topics: consistency model recap, introduction to transactional memory 1 Example Programs Initially, A = B = 0 P1 P2 A = 1 B = 1 if (B == 0) if (A == 0) critical section
More informationTechnical Report. Automatically proving linearizability. Viktor Vafeiadis. Number 778. September Computer Laboratory
Technical Report UCAM-CL-TR-778 ISSN 1476-2986 Number 778 Computer Laboratory Automatically proving linearizability Viktor Vafeiadis September 2016 15 JJ Thomson Avenue Cambridge CB3 0FD United Kingdom
More informationCS32 - Week 2. Umut Oztok. July 1, Umut Oztok CS32 - Week 2
CS32 - Week 2 Umut Oztok July 1, 2016 Arrays A basic data structure (commonly used). Organize data in a sequential way. Arrays A basic data structure (commonly used). Organize data in a sequential way.
More informationProving Lock-Freedom Easily and Automatically
Proving Lock-Freedom Easily and Automatically Xiao Jia Wei Li Shanghai Jiao Tong University Viktor Vafeiadis Max Planck Institute for Software Systems (MPI-SWS) Abstract Lock-freedom is a liveness property
More informationLecture 9: Multiprocessor OSs & Synchronization. CSC 469H1F Fall 2006 Angela Demke Brown
Lecture 9: Multiprocessor OSs & Synchronization CSC 469H1F Fall 2006 Angela Demke Brown The Problem Coordinated management of shared resources Resources may be accessed by multiple threads Need to control
More informationFormal Verification of Lock-Free Algorithms
2009 Ninth International Conference on Application of Concurrency to System Design Formal Verification of Lock-Free Algorithms (Invited Paper) Gerhard Schellhorn, Simon Bäumler Institute for Software and
More informationThe Bucharest University of Economic Studies. Data Structures. ADTs-Abstract Data Types Stacks and Queues
The Bucharest University of Economic Studies Data Structures ADTs-Abstract Data Types Stacks and Queues Agenda Definition Graphical representation Internal interpretation Characteristics Operations Implementations
More informationAll the above operations should be preferably implemented in O(1) time. End of the Queue. Front of the Queue. End Enqueue
Module 4: Queue ADT Dr. Natarajan Meghanathan Professor of Computer Science Jackson State University Jackson, MS 39217 E-mail: natarajan.meghanathan@jsums.edu Queue ADT Features (Logical View) A List that
More informationPromela and SPIN. Mads Dam Dept. Microelectronics and Information Technology Royal Institute of Technology, KTH. Promela and SPIN
Promela and SPIN Mads Dam Dept. Microelectronics and Information Technology Royal Institute of Technology, KTH Promela and SPIN Promela (Protocol Meta Language): Language for modelling discrete, event-driven
More informationThat means circular linked list is similar to the single linked list except that the last node points to the first node in the list.
Leaning Objective: In this Module you will be learning the following: Circular Linked Lists and it operations Introduction: Circular linked list is a sequence of elements in which every element has link
More informationLANGUAGE SUPPORT AND COMPILER OPTIMIZATIONS FOR OBJECT-BASED SOFTWARE TRANSACTIONAL MEMORY GUY EDDON B.A., THOMAS EDISON STATE COLLEGE, 2002
LANGUAGE SUPPORT AND COMPILER OPTIMIZATIONS FOR OBJECT-BASED SOFTWARE TRANSACTIONAL MEMORY BY GUY EDDON B.A., THOMAS EDISON STATE COLLEGE, 2002 Sc.M., BROWN UNIVERSITY, 2004 A DISSERTATION SUBMITTED IN
More informationSection 4 Concurrent Objects Correctness, Progress and Efficiency
Section 4 Concurrent Objects Correctness, Progress and Efficiency CS586 - Panagiota Fatourou 1 Concurrent Objects A concurrent object is a data object shared by concurrently executing processes. Each object
More informationOrder Is A Lie. Are you sure you know how your code runs?
Order Is A Lie Are you sure you know how your code runs? Order in code is not respected by Compilers Processors (out-of-order execution) SMP Cache Management Understanding execution order in a multithreaded
More informationCMPSCI 250: Introduction to Computation. Lecture #14: Induction and Recursion (Still More Induction) David Mix Barrington 14 March 2013
CMPSCI 250: Introduction to Computation Lecture #14: Induction and Recursion (Still More Induction) David Mix Barrington 14 March 2013 Induction and Recursion Three Rules for Recursive Algorithms Proving
More informationPart 3: Beyond Reduction
Lightweight Analyses For Reliable Concurrency Part 3: Beyond Reduction Stephen Freund Williams College joint work with Cormac Flanagan (UCSC), Shaz Qadeer (MSR) Busy Acquire Busy Acquire void busy_acquire()
More informationProgress Guarantees When Composing Lock-Free Objects
Progress Guarantees When Composing Lock-Free Objects Nhan Nguyen Dang and Philippas Tsigas Department of Computer Science and Engineering Chalmers University of Technology Gothenburg, Sweden {nhann,tsigas}@chalmers.se
More informationLOCKLESS ALGORITHMS. Lockless Algorithms. CAS based algorithms stack order linked list
Lockless Algorithms CAS based algorithms stack order linked list CS4021/4521 2017 jones@scss.tcd.ie School of Computer Science and Statistics, Trinity College Dublin 2-Jan-18 1 Obstruction, Lock and Wait
More informationStatic Analysis of Atomicity for Programs with Non-Blocking Synchronization
Static Analysis of Atomicity for Programs with Non-Blocking Synchronization Liqiang Wang Department of Computer Science State University of New York at Stony Brook Stony Brook, NY 11794, USA liqiang@cs.sunysb.edu
More informationC Data Structures Stacks. Stack. push Adds a new node to the top of the stack
1 12 C Data Structures 12.5 Stacks 2 Stack New nodes can be added and removed only at the top Similar to a pile of dishes Last-in, first-out (LIFO) Bottom of stack indicated by a link member to NULL Constrained
More informationAlgorithms and Data Structures
Algorithms and Data Structures CSE 465 LECTURE 9 Abstract Data Types Queues Sofya Raskhodnikova and Adam Smith 1 Data Structures So far in this class: designing algorithms Inputs and outputs were specified,
More informationDATA STRUCTURE UNIT I
DATA STRUCTURE UNIT I 1. What is Data Structure? A data structure is a mathematical or logical way of organizing data in the memory that consider not only the items stored but also the relationship to
More informationStacks and queues (chapters 6.6, 15.1, 15.5)
Stacks and queues (chapters 6.6, 15.1, 15.5) So far... Complexity analysis For recursive and iterative programs Sorting algorithms Insertion, selection, quick, merge, (intro, dual-pivot quick, natural
More informationConcurrent Systems. XIII. Progress Guarantee. Wolfgang Schröder-Preikschat. Selbststudium. Nebenläufige Systeme
Concurrent Systems Nebenläufige Systeme XIII. Progress Guarantee Wolfgang Schröder-Preikschat Selbststudium Agenda In a Nutshell wosch CS ( Selbststudium ) In a Nutshell 2 Outline In a Nutshell wosch CS
More informationMarwan Burelle. Parallel and Concurrent Programming
marwan.burelle@lse.epita.fr http://wiki-prog.infoprepa.epita.fr Outline 1 2 Solutions Overview 1 Sharing Data First, always try to apply the following mantra: Don t share data! When non-scalar data are
More informationFormal Specification and Verification
Formal Specification and Verification Introduction to Promela Bernhard Beckert Based on a lecture by Wolfgang Ahrendt and Reiner Hähnle at Chalmers University, Göteborg Formal Specification and Verification:
More informationAsynchronous Models. Chapter Asynchronous Processes States, Inputs, and Outputs
Chapter 3 Asynchronous Models 3.1 Asynchronous Processes Like a synchronous reactive component, an asynchronous process interacts with other processes via inputs and outputs, and maintains an internal
More informationLock Oscillation: Boosting the Performance of Concurrent Data Structures
Lock Oscillation: Boosting the Performance of Concurrent Data Structures Panagiota Fatourou FORTH ICS & University of Crete Nikolaos D. Kallimanis FORTH ICS The Multicore Era The dominance of Multicore
More informationCSC 1052 Algorithms & Data Structures II: Linked Queues
CSC 1052 Algorithms & Data Structures II: Linked Queues Professor Henry Carter Spring 2018 Recap A queue simulates a waiting line, where objects are removed in the same order they are added The primary
More informationHazard Pointers. Number of threads unbounded time to check hazard pointers also unbounded! difficult dynamic bookkeeping! thread B - hp1 - hp2
Hazard Pointers Store pointers of memory references about to be accessed by a thread Memory allocation checks all hazard pointers to avoid the ABA problem thread A - hp1 - hp2 thread B - hp1 - hp2 thread
More information! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)
Final Exam Exercises CS 2308 Spring 2014 Jill Seaman Chapters 1-7 + 11 Write C++ code to: Determine if a number is odd or even Determine if a number/character is in a range - 1 to 10 (inclusive) - between
More information[module 2.2] MODELING CONCURRENT PROGRAM EXECUTION
v1.0 20130407 Programmazione Avanzata e Paradigmi Ingegneria e Scienze Informatiche - UNIBO a.a 2013/2014 Lecturer: Alessandro Ricci [module 2.2] MODELING CONCURRENT PROGRAM EXECUTION 1 SUMMARY Making
More informationAdvance Operating Systems (CS202) Locks Discussion
Advance Operating Systems (CS202) Locks Discussion Threads Locks Spin Locks Array-based Locks MCS Locks Sequential Locks Road Map Threads Global variables and static objects are shared Stored in the static
More informationProgramming Paradigms for Concurrency Lecture 3 Concurrent Objects
Programming Paradigms for Concurrency Lecture 3 Concurrent Objects Based on companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit Modified by Thomas Wies New York University
More informationAutomatically Proving Linearizability
Automatically Proving Linearizability Viktor Vafeiadis University of Cambridge Abstract. This paper presents a practical automatic verification procedure for proving linearizability (i.e., atomicity and
More informationSymmetric Multiprocessors: Synchronization and Sequential Consistency
Constructive Computer Architecture Symmetric Multiprocessors: Synchronization and Sequential Consistency Arvind Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology November
More informationBlocking Non-blocking Caveat:
Overview of Lecture 5 1 Progress Properties 2 Blocking The Art of Multiprocessor Programming. Maurice Herlihy and Nir Shavit. Morgan Kaufmann, 2008. Deadlock-free: some thread trying to get the lock eventually
More informationData Structures and Algorithms. Chapter 5. Dynamic Data Structures and Abstract Data Types
1 Data Structures and Algorithms Chapter 5 and Abstract Data Types Werner Nutt 2 Acknowledgments The course follows the book Introduction to Algorithms, by Cormen, Leiserson, Rivest and Stein, MIT Press
More informationModel Checking of Linearizability of Concurrent List Implementations
University of Pennsylvania ScholarlyCommons Departmental Papers (CIS) Department of Computer & Information Science 7-2010 Model Checking of Linearizability of Concurrent List Implementations Pavol Cerný
More informationShape-Value Abstraction for Verifying Linearizability
Shape-Value Abstraction for Verifying Linearizability Viktor Vafeiadis Microsoft Research, Cambridge, UK Abstract. This paper presents a novel abstraction for heap-allocated data structures that keeps
More informationSets and Sequences vs. Linked Lists
Sets and Sequences vs. Linked Lists Florent Bouchez Tichadou September 24, 2018 We have seen previously that it is possible to use arrays (low-level structure) to hold sets or sequences (high-level structures).
More informationQueues. October 20, 2017 Hassan Khosravi / Geoffrey Tien 1
Queues October 20, 2017 Hassan Khosravi / Geoffrey Tien 1 Queue ADT Queue ADT should support at least the first two operations: enqueue insert an item to the back of the queue dequeue remove an item from
More informationLecture Notes on Queues
Lecture Notes on Queues 15-122: Principles of Imperative Computation Frank Pfenning Lecture 9 September 25, 2012 1 Introduction In this lecture we introduce queues as a data structure and linked lists
More informationDistributed Systems Synchronization. Marcus Völp 2007
Distributed Systems Synchronization Marcus Völp 2007 1 Purpose of this Lecture Synchronization Locking Analysis / Comparison Distributed Operating Systems 2007 Marcus Völp 2 Overview Introduction Hardware
More informationCS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University
CS 333 Introduction to Operating Systems Class 3 Threads & Concurrency Jonathan Walpole Computer Science Portland State University 1 Process creation in UNIX All processes have a unique process id getpid(),
More information