A Completeness theorem for a class of synchronization objects Afek.Y, Weisberger.E, Weisman.H Presented by: Reut Schwartz.

Slides:



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

Mutual Exclusion – SW & HW By Oded Regev. Outline: Short review on the Bakery algorithm Short review on the Bakery algorithm Black & White Algorithm Black.
Sorting an Intransitive Total Ordered Set
1 © R. Guerraoui The Limitations of Registers R. Guerraoui Distributed Programming Laboratory.
N-Consensus is the Second Strongest Object for N+1 Processes Eli Gafni UCLA Petr Kuznetsov Max Planck Institute for Software Systems.
© 2005 P. Kouznetsov Computing with Reads and Writes in the Absence of Step Contention Hagit Attiya Rachid Guerraoui Petr Kouznetsov School of Computer.
1 Chapter 4 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
Primitive Recursive Functions (Chapter 3)
CSE 486/586, Spring 2012 CSE 486/586 Distributed Systems Consensus Steve Ko Computer Sciences and Engineering University at Buffalo.
1 Synchronization 2: semaphores and more… 1 Operating Systems, 2011, Danny Hendler & Amnon Meisels.
Ch. 7 Process Synchronization (1/2) I Background F Producer - Consumer process :  Compiler, Assembler, Loader, · · · · · · F Bounded buffer.
Mutual Exclusion By Shiran Mizrahi. Critical Section class Counter { private int value = 1; //counter starts at one public Counter(int c) { //constructor.
1 Chapter 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2007 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld.
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2013 Operating System Concepts – 9 th Edition Chapter 5: Process Synchronization.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Multiprocessor Synchronization Algorithms ( ) Lecturer: Danny Hendler The Mutual Exclusion problem.
Scalable Synchronous Queues By William N. Scherer III, Doug Lea, and Michael L. Scott Presented by Ran Isenberg.
1 Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation.
1 Chapter 3 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
1 Course Syllabus 1. Introduction - History; Views; Concepts; Structure 2. Process Management - Processes; State + Resources; Threads; Unix implementation.
Granularity of Locks and Degrees of Consistency in a Shared Data Base John LaFontaine Haixuan Sun.
Chapter 6: Process Synchronization. Outline Background Critical-Section Problem Peterson’s Solution Synchronization Hardware Semaphores Classic Problems.
Distributed Algorithms (22903) Lecturer: Danny Hendler Shared objects: linearizability, wait-freedom and simulations Most of this presentation is based.
Contention in shared memory multiprocessors Multiprocessor synchronization algorithms ( ) Lecturer: Danny Hendler Definitions Lower bound for consensus.
Contention in shared memory multiprocessors Multiprocessor synchronization algorithms ( ) Lecturer: Danny Hendler Definitions Lower bound for consensus.
Instructor: Umar KalimNUST Institute of Information Technology Operating Systems Process Synchronization.
CS4231 Parallel and Distributed Algorithms AY 2006/2007 Semester 2 Lecture 3 (26/01/2006) Instructor: Haifeng YU.
1 Chapter 9 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
1 Chapter 10 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 7: Process Synchronization Background The Critical-Section Problem Synchronization.
Mutual Exclusion Using Atomic Registers Lecturer: Netanel Dahan Instructor: Prof. Yehuda Afek B.Sc. Seminar on Distributed Computation Tel-Aviv University.
Common2 extended to stacks and unbound concurrency By:Yehuda Afek Eli Gafni Adam Morrison May 2007 Presentor: Dima Liahovitsky 1.
1 Chapter 2 Synchronization Algorithms and Concurrent Programming Gadi Taubenfeld © 2014 Synchronization Algorithms and Concurrent Programming Synchronization.
CS294, Yelick Consensus revisited, p1 CS Consensus Revisited
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.
Concurrent Computing Seminar Introductory Lecture Instructor: Danny Hendler
Distributed Algorithms (22903)
Bakery Algorithm - Proof
Process Synchronization
O(log n / log log n) RMRs Randomized Mutual Exclusion
Faster Data Structures in Transactional Memory using Three Paths
O(log n / log log n) RMRs Randomized Mutual Exclusion
Computing with anonymous processes
Chapter 5: Process Synchronization
Challenges in Concurrent Computing
Distributed Algorithms (22903)
CSCE 668 DISTRIBUTED ALGORITHMS AND SYSTEMS
(Slides were added to Keren’s original presentation. DH.)
Process Synchronization
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Distributed Algorithms (22903)
Critical section problem
The Relative Power of Synchronization Methods
Distributed Algorithms (22903)
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Multiprocessor Synchronization Algorithms ( )
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Lecture 1: Introduction
Distributed Algorithms (22903)
Distributed Algorithms (22903)
Chapter 6: Synchronization Tools
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
Distributed Algorithms (22903)
Course Syllabus 1. Introduction - History; Views; Concepts; Structure
CSE 542: Operating Systems
CSE 542: Operating Systems
Syllabus 1. Introduction - History; Views; Concepts; Structure
(Slides were added to Keren’s original presentation. DH.)
Presentation transcript:

A Completeness theorem for a class of synchronization objects Afek.Y, Weisberger.E, Weisman.H Presented by: Reut Schwartz

Talk outline  Introduction  Model definitions  Implementations  The test-and-set and tournament objects  Single-use fetch-and-increment  Multi-use fetch-and-increment  Summary

Introduction Let define few terms which we will use later. Common2- – class of synchronization objects – contains read-modify-write objects that commute (e.g. fetch-and-add), or overwrite (e.g. swap). – Contained in the consensus number2 class. Consensus number 2 Common2

Consensus- Reminder an object has consensus number k if any number of this object and of read/write registers can be used to implement a k- consensus protocol, and no more.

The wait-free hierarchy 1Read/write atomic registers 2Test-and-set, fetch-and- add, fetch-and-increment, queue and swap. … Compare-and-swap

Article Goal To show that any object in the common2 class can implement any other object in the class, in a system with an arbitrary number of processes. In fact common2 are implementable from any object with consensus number 2. It is unique because we can implement objects that can be accessed by more processes then their consensus number.

More Definitions Let F be a set of functions indexed by set S. F is commuting if example: F is overwriting if either or example: Y=0X=1

Talk outline  Introduction  Model definitions  Implementations  The test-and-set and tournament objects  Single-use fetch-and-increment  Multi-use fetch-and-increment  Summary

Model Definition System with n processes (P1...Pn) Communicate through shared objects. Objects has type and set of primitive operations. Two type of objects: – A single-use object (SU-object) – A multi-use object (MU-object)

Notation 2P-foobar is an object that can be accessed by at most 2 processes. swmr- single writer multiple readers. swsr- single writer single reader. mwmr- multiple writer multiple readers.

Talk outline  Introduction  Model definitions  Implementations  The test-and-set and tournament objects  Single-use fetch-and-increment  Multi-use fetch-and-increment  Summary

Test-and-set and tournament objects Tournament object- returns to one process(the winner) 0 and to any other process the identity of another process. Impose an acyclic partial order. We say that p2.compete() is linearized after p1.compete() 3210 P0.compete() P1.compete()P2.compete() P0 P1 P2 …

Linearizability- remainder Linearizability: (an intuitive definition) Can find a point within the time-interval of each operation, where the operation took place, such that the operations order is legal. P0.compete() P1.compete()P2.compete() time

Operating Systems, 2010, Danny Hendler & Amnon Meisels 16 A tournament tree- remainder Level 0 Level 1 Level 2 Processes A tree-node is identified by: [level, node#] Synchronization Algorithms and Concurrent Programming, Gadi Taubenfeld © 2006

Test-and-set and tournament objects The problem: it does not satisfy linearzability. The solution: gate Each process that starts the compete operation prevents any process that has not yet started, from starting, by closing the gate. P1P0 CAN I PASS? NO! WAIT…

Test-and-set and tournament objects Option 1: the gate is open Option 2: the gate returns non-null value P1 Reading gate… ID IS 1 Reading gate… Return 0 P0 NULL CONTINUE… Return 0 GO AWAY!

Operation compete

Proof outline There is at most one winner in each tournament. The relation defines an acyclic partial order between the operations of the tournament. thus, there is only one winner. The use of the gate insures Linearizability. Wait-freedom follows from the code. P1 P2 P3 … Pk-1 Pk Pi+1 Pi Pi-1 P1 P2 P3 level=l’ level=l l’<l

Talk outline  Introduction  Model definitions  Implementations  The test-and-set and tournament objects  Single-use fetch-and-increment  Multi-use fetch-and-increment  Summary

Single-use fetch-and-increment Reminder: fetch-and-increment: f(r)=r+1 Solution: Linear array T[0,…,n] of n test-and-set registers. To perform a fetch-and-increment each process start performing test-and-set on the array trying to win. A process that won in T[i] returns i.

Proof outline Test-and-set are wait-free so… the implementation is wait-free. Only one process wins in each location so… each process returns a unique value. When a process returns j, the operation that will return k, k<j have already started so… the code insures linearizability.

Simple Example T: P0 wins and return 0, P1 and P2 lose, they all continue. P0 wins again and return 1, they all continue. Problem: it is not wait-free! P0.test-and-set P1.test-and-setP2.test-and-set P1.test-and-set P2.test-and-setP0.test-and-set 00011

Talk outline  Introduction  Model definitions  Implementations  The test-and-set and tournament objects  Single-use fetch-and-increment  Multi-use fetch-and-increment  Summary

Multi-use fetch-and-increment Solution: T[0,..]- an infinite linear array as before. Process choose p such that there is unset register between T[p] and T[p-k] my_inc[i] – swmr register, holds the number of increments Pi performs. Each process take a snapshot of all my_inc values, and compute their sum.

Multi-use fetch-and-increment my_minSS[i]- swmr register, contains list of snapshots at most one for each other process sum(ss)- sum of the n my_inc values in ss. Max(L,i)- max value of process Pi’s my_inc. minSS(L,i)- snapshot in L with a minimum sum among those in which Pi’s value is max(L,i). relevantSS(L) = {minSS(L,i) : i=1…n}

Simple Example T: Step 1: P1 P2 P3 my_inc Step 2: P1 takes a snapshot. Notice that mean time holes can be created by other processes performing test-and-set For example: P2 performed action. T:

Simple Example Problem: snapshot of P1 is not valid. Solution: Step 3: P1 save a copy of relevant snapshot for each other process. P1 holds these snapshots: L[1]: L[2]: my_minSS[1] P2 P3 1 1 P1

Simple Example P2 holds these snapshots: L[1]: L[2]: P3 holds these snapshots: L[1]: L[2]: Step 4: each process holds the most relevant in my_minSS[i] my_minSS[2] my_minSS[3] P3 P1 P P3 0 1 P2

Simple Example Step 5: summation of all my_inc values in ss. P1 summation is: Step 6: calculate max(L,i) and minSS(L,i) Max(L,1) = 1 minSS(L,1)=2 Step 7: define relevantSS= {minSS(L,i) : i=1..3} relevantSS(L)= {2,3,2} Step 8: P1 choose as an entry point : 2 2

The code

conclusion The code correctly implements fetch-and- increment. Each operation terminates in at most n^2 accesses to the shard memory. At most n test-and-set operations on the test&set array.

Proof outline Proof outline In order to show the intuitive correctness of the algorithm let us see a simpler one: V[i].update(V[i]+1) //each process increment it’s my_inc S<- scan(inc[j]) // performs a scan of other processes my_inc value entry<-sum(S) //entry is the sum of the values scan_down_from_entry(entry) //scaning down to find an unset register to perform T&S.

Proof outline Correctness of the simple algorithm is simple. Our algorithm is an optimization of the simple one. It tries to make sure that when trying to find an unset register there will not be “too-much” scanning down.

Talk outline  Introduction  Model definitions  Implementations  The test-and-set and tournament objects  Single-use fetch-and-increment  Multi-use fetch-and-increment  Summary

Summary This article prove several important issues: common2 are implementable from any object with consensus number 2. we can implement objects that can be accessed by more processes then their consensus number.

Summary Important question still remain open: Is it possible to implement any object with consensus number two with another object in this class for an arbitrary number of processes?

Questions?

Thank You!