Download presentation

Presentation is loading. Please wait.

Published byKelsie Doidge Modified over 2 years ago

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

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

3
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

6
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.

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

8
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.

9
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

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

11
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)

12
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.

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

14
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 …

15
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

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

17
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…

18
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!

19
Operation compete

20
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’

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

22
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.

23
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

24
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! 00000 P0.test-and-set P1.test-and-setP2.test-and-set 00001 P1.test-and-set P2.test-and-setP0.test-and-set 00011

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

26
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.

27
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}

28
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: 1 0 1 00011 10011 1 01

29
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]: 0 1 1 1 my_minSS[1] P2 P3 1 1 P1

30
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] 1 1 1 1 1 1 my_minSS[2] my_minSS[3] P3 P1 P2 0 1 1 1 P3 0 1 P2

31
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

32
The code

33
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.

34
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.

35
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.

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

37
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.

38
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?

39
Questions?

40
Thank You!

Similar presentations

OK

1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples.

1 The Computability of Relaxed Data Structures: Queues and Stacks as Examples The Computability of Relaxed Data Structures: Queues and Stacks as Examples.

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google