Common2 Extended to Stacks Adam Morrison joint with Eli Gafni Yehuda Afek.

Slides:



Advertisements
Similar presentations
1 © R. Guerraoui Universal constructions R. Guerraoui Distributed Programming Laboratory.
Advertisements

Stacks, Queues, and Linked Lists
Hongjin Liang and Xinyu Feng
N-Consensus is the Second Strongest Object for N+1 Processes Eli Gafni UCLA Petr Kuznetsov Max Planck Institute for Software Systems.
Prof. Jennifer Welch 1. FIFO Queue Example 2  Sequential specification of a FIFO queue:  operation with invocation enq(x) and response ack  operation.
CPSC 668Set 18: Wait-Free Simulations Beyond Registers1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials Stack and Queues.
Theory of Computing Lecture 6 MAS 714 Hartmut Klauck.
A Mile-High View of Concurrent Algorithms Hagit Attiya Technion.
CPSC 668Set 16: Distributed Shared Memory1 CPSC 668 Distributed Algorithms and Systems Fall 2006 Prof. Jennifer Welch.
Introduction to Lock-free Data-structures and algorithms Micah J Best May 14/09.
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
Programming Language Semantics Java Threads and Locks Informal Introduction The Java Specification Language Chapter 17.
What Can Be Implemented Anonymously ? Paper by Rachid Guerraui and Eric Ruppert Presentation by Amir Anter 1.
Wait-Free Consensus with Infinite Arrivals James Aspnes Gauri Shah Jatin Shah Yale University STOC 2002.
The Potential Method. Deque with stacks size=7 13 S1S1 S2S2 push(x,D): push(x,S 1 ) push(2,D)
Comparison Under Abstraction for Verifying Linearizability Daphna Amit Noam Rinetzky Mooly Sagiv Tom RepsEran Yahav Tel Aviv UniversityUniversity of Wisconsin.
CS 206 Introduction to Computer Science II 10 / 28 / 2009 Instructor: Michael Eckmann.
Synchronization Methods for Multicore Programming Brendan Lynch.
1 Lock-Free Linked Lists Using Compare-and-Swap by John Valois Speaker’s Name: Talk Title: Larry Bush.
Abstract Data Types (ADTs) and data structures: terminology and definitions A type is a collection of values. For example, the boolean type consists of.
Fundamentals of Python: From First Programs Through Data Structures Chapter 14 Linear Collections: Stacks.
Triangulating a monotone polygon
Simple Wait-Free Snapshots for Real-Time Systems with Sporadic Tasks Håkan Sundell Philippas Tsigas.
Mastering STACKS AN INTRODUCTION TO STACKS Data Structures.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 18: Wait-Free Simulations Beyond Registers 1.
Data Structures and Algorithms Stacks. Stacks are a special form of collection with LIFO semantics Two methods int push( Stack s, void *item ); - add.
Computer Science Department Data Structure & Algorithms Lecture 8 Recursion.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
Atomic Snapshots. Abstract Data Types Abstract representation of data & set of methods (operations) for accessing it Implement using primitives on base.
The Stack This is a special data structure: –The first item to be placed into the stack will be the last item taken out. Two basic operations: –Push: Places.
Introduction to Data Structures and Algorithms CS 110: Data Structures and Algorithms First Semester,
Hierarchical Quorum Consensus: A New Algorithm for Managing Replicated Data Akhil Kumar IEEE TRANSACTION ON COMPUTERS, VOL.40, NO.9, SEPTEMBER 1991.
1 Chapter 9 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
1 Consensus Hierarchy Part 1. 2 Consensus in Shared Memory Consider processors in shared memory: which try to solve the consensus problem.
For more notes and topics VISIT: IMPLEMENTATION OF STACKS eITnotes.com.
C++ Programming: Program Design Including Data Structures, Fourth Edition Chapter 18: Stacks and Queues.
Wait-Free Consensus CPSC 661 Fall 2003 Supervised by: Lisa Higham Presented by: Wei Wei Zheng Nuha Kamaluddeen.
Common2 extended to stacks and unbound concurrency By:Yehuda Afek Eli Gafni Adam Morrison May 2007 Presentor: Dima Liahovitsky 1.
1 Consensus Hierarchy Part 2. 2 FIFO (Queue) FIFO Object headtail.
Model Checking Linearizability via Refinement 1 ICFEM 2008 Model Checking Linearizability via Refinement Yang LIU, Wei CHEN, Yanhong A. LIU, and Jun SUN.
1 Stacks & Queues CSC Stacks & Queues Stack: Last In First Out (LIFO). –Used in procedure calls, to compute arithmetic expressions etc. Queue: First.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
Copyright © Curt Hill Stacks An Useful Abstract Data Type.
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS Fall 2011 Prof. Jennifer Welch CSCE 668 Set 16: Distributed Shared Memory 1.
Distributed Algorithms (22903) Lecturer: Danny Hendler The wait-free hierarchy and the universality of consensus This presentation is based on the book.
Computer Engineering Rabie A. Ramadan Lecture 6.
Data Structures Evolution of algorithms for an array-based stack, queue, and linked-list. Evolved data structures used to evolve solutions to problems.
1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples.
Distributed Algorithms (22903) Lecturer: Danny Hendler The Atomic Snapshot Object The Renaming Problem This presentation is based on the book “Distributed.
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.
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
The Relative Power of Synchronization Operations Companion slides for The Art of Multiprocessor Programming by Maurice Herlihy & Nir Shavit.
DATA STRUCURES II CSC QUIZ 1. What is Data Structure ? 2. Mention the classifications of data structure giving example of each. 3. Briefly explain.
The Concurrency Hierarchy and Algorithms for Unbounded Concurrency Eli Gafni Michael Merritt Gadi Taubenfeld.
Distributed Algorithms (22903)
A Lock-Free Algorithm for Concurrent Bags
Stack Memory 1 (also called Call Stack)
Distributed Algorithms (22903)
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
Distributed Algorithms (22903)
Data structures.
Jordi Cortadella and Jordi Petit Department of Computer Science
Distributed Algorithms (22903)
Deterministic Objects: Life Beyond Consensus
Distributed Algorithms (22903)
Yehuda Afek, Eli Daian, Eli Gafni, Giuliano Losa
Stacks A stack is an ordered set of elements, for which only the last element placed into the stack is accessible. The stack data type is also known as.
(The Stack and Procedures)
Presentation transcript:

Common2 Extended to Stacks Adam Morrison joint with Eli Gafni Yehuda Afek

Model Shared memory model.Shared memory model. Wait-free linearizable algorithms.Wait-free linearizable algorithms.

Computability

Computability Snapshot implementation from read-write registers. Snapshot implementation from read-write registers.Stack? X implementation from stacks and read-write registers? X implementation from stacks and read-write registers?

Wait-free hierarchy Consensus number 1 2 … [Herlihy 91] Object’s consensus number: Maximum number of processes that can implement consensus using copies of the object and R/W registers. R/W registers.

Wait-free hierarchy Consensus number 1 2 … Stack Register [Herlihy 91]

Wait-free hierarchy Consensus number 1 2 … Stack F&A Swap Queue Register [Herlihy 91] swap(x): old := v v := x return old F&A(x): old := v v += x return old

Queue Wait-free hierarchy Consensus number 1 2 … Stack F&A Swap Register [Herlihy 91] More than 2 processes? Common2

Queue This talk Consensus number 1 2 … Stack F&A Swap Register Common2

Stack algorithm 0 r cells Ø Ø Ø Ø Ø Ø Ø

Pop() {Push(x) { for t:=F&A(r,0)-1 t := F&A(r,1) for t:=F&A(r,0)-1 t := F&A(r,1) downto 0 { cells[t] := x downto 0 { cells[t] := x x := swap(cells[t], Ø)} x := swap(cells[t], Ø)} if (x != Ø( return x if (x != Ø( return x } return EMPTY return EMPTY{ Stack algorithm 0 r cells Push(x) 1 x Push(y) 2 Pop Swap Swap Ø Ø Ø Ø Ø Ø Ø Wait-free

Linearizability proof

Concurrent matching Push/Pop pairs can be ignored.Concurrent matching Push/Pop pairs can be ignored. Obtain an execution where Pop starts after corresponding Push has finished. Push(x)Push(y) Pop: y Push(z) Pop: z

Linearizability proof Linearizability: assign each operation a linearization point at some event during its execution. Handling ties: build explicit sequential order to breaks ties.

Linearizing procedure that processes the execution, using an auxiliary array, and outputs a linearization. Proof technique aux

Auxiliary array aux x Lin=Push(y) Pop:y Push(x)

Push is linearized when it writes: If to top of array, linearized now. Else, with the Push above it. Linearizing Push() aux x zPush(z) Lin=Push(y) Pop:y Push(x) Push(w) w Lin=Push(y) Pop:y Push(w) Push(x) Push(z)

Pops are linearized as soon as their return value is at top of the auxiliary array. Linearizing Pop() cells x z w Lin=Push(y) Pop:y Push(w) Push(x) Push(z) Pop:xPop:z Pop:x x z w Pop:x aux Pop:z Pop:zEMPTY

Linearization proc correctness Linearization is a valid stack execution.Linearization is a valid stack execution. Linearization respects real-time order.Linearization respects real-time order.

Push is linearized when it writes: If to top of array, linearized now. Else, with the Push above it. Linearizing Push() aux x zPush(z) Push(w) w Push(w) Push(x) F&A F&Awrite write

Linearization proc correctness Linearization is a valid stack execution.Linearization is a valid stack execution. Linearization respects real-time order.Linearization respects real-time order. Every operation is linearized.Every operation is linearized.

Pops are linearized as soon as their return value is at top of the auxiliary array. Every Pop() is linearized cells x z Pop:x x z Pop:x aux Pop:z ww Pop:x – first to finish without being linearized

Linearization proc correctness Linearization is a valid stack execution.Linearization is a valid stack execution. Linearization respects real-time order.Linearization respects real-time order. Every operation is linearized.Every operation is linearized.

Queue Conclusion Consensus number 1 2 … Stack F&A Swap Register Common2 ?