Atomic snapshots in O (log³ n) steps using randomized helping

18
Atomic snapshots in O(log³ n) steps using randomized helping James Aspnes, Yale Keren Censor-Hillel, Technion 1

description

Atomic snapshots in O (log³ n) steps using randomized helping. James Aspnes , Yale Keren Censor-Hillel, Technion. Snapshot Objects. …. update( v ). scan. r ead all locations. update your location. p 1. p 2. p n. …. Model. R 1. R 2. R. …. read. v. write( v ). ok. p 1. p 2. - PowerPoint PPT Presentation

Transcript of Atomic snapshots in O (log³ n) steps using randomized helping

Page 1: Atomic snapshots in  O (log³ n) steps using randomized helping

1

Atomic snapshots in O(log³ n) steps using randomized helping

James Aspnes, YaleKeren Censor-Hillel, Technion

Page 2: Atomic snapshots in  O (log³ n) steps using randomized helping

Snapshot Objects

p1 p2 pn…

update(v) scan

2

update your location

read all locations

Page 3: Atomic snapshots in  O (log³ n) steps using randomized helping

3

Model

System of n processes, multi-writer registersAsynchronous schedule controlled by an adversaryCrash failures – require wait-free implementationsLinearizable implementations

p1 p2

R1

pn

R2 R…

read v write(v) ok

Page 4: Atomic snapshots in  O (log³ n) steps using randomized helping

4

Snapshots - Step ComplexityUsing multi-writer registers:

can be done in O(n) steps [Inoue and Chen, WDAG 1994]

and requires Ω(n) steps [Jayanti, Tan, and Toueg, SICOMP 1996]

Goal: a faster snapshot implementation (polylog)

Limited-use: O(log3(n)) steps per operation, for polynomially many update operations [Aspnes, Attiya, Censor-Hillel, and Ellen, PODC 2012]

This Talk: O(log3(n)) steps per operation, with high probability(without a usage bound)

Page 5: Atomic snapshots in  O (log³ n) steps using randomized helping

5

Pointer to array location

s1 s2 s3 s4

s1+s2 s3+s4

s1+...+s4

0

Tree structure, Updates help Scans

0 01 1

12

2 2

3

3

45

Array of views

5X

[Aspnes, Attiya, Censor-Hillel, and Ellen, PODC 2012] O(log n)

steps?

Page 6: Atomic snapshots in  O (log³ n) steps using randomized helping

6

Two Challenges

s1 s2 s3 s4

s1+s2 s3+s4

s1+...+s4

5

1. Coping with slow operations. Max-register: returns largest

value previously written [Aspnes, Attiya, and

Censor-Hillel, JACM 2012]

Consecutive values differ by

at most n

Page 7: Atomic snapshots in  O (log³ n) steps using randomized helping

7

Two Challenges

s1 s2 s3 s4

s1+s2 s3+s4

s1+...+s4

5

2. Guaranteeing consistent views. Max-array: returns comparable

pairs of max-register values [Aspnes, Attiya, Censor-Hillel, and Ellen,

PODC 2012]

Page 8: Atomic snapshots in  O (log³ n) steps using randomized helping

8

Our Results

Randomized max-register in O(logn) steps with high probability

Randomized 2-component max-arrayO(log2n) steps whp

Randomized snapshot in O(log3n) steps whp

Main technique: randomized helping

Page 9: Atomic snapshots in  O (log³ n) steps using randomized helping

9

Max-Register

switch = 0

switch = 0 switch = 0

value 0 value 1

value v value v’

… ……

write(v)

switch = 1 read

Page 10: Atomic snapshots in  O (log³ n) steps using randomized helping

10

Max-Register

switch = 0

switch = 0 switch = 0

value 0 value 1

value v value v’

… ……

write(v)

switch = 1 read

write(v’)

switch = 1

write(v’’)

Page 11: Atomic snapshots in  O (log³ n) steps using randomized helping

11

Randomized Max-Register

switch = 0

switch = 0

switch = 0

write(v)

switch = 1

switch = 1

m-valued max register

Page 12: Atomic snapshots in  O (log³ n) steps using randomized helping

12

Randomized Max-Register

switch = 0

switch = 0

switch = 0

write(v)

switch = 1

switch = 1k-bounded increments:

value of write ≤ k + value of largest write

m-valued max register

O(log m + kn/m) = O(log n) steps per write

Page 13: Atomic snapshots in  O (log³ n) steps using randomized helping

13

Writing to the Max-Register

0

write(v)

1

1…TS:

…HELP:

…POINTER:

write(v)pi

v', ts[j]TS[j]

pj (cyclic)

i

read

(random)

size n3

read v’ = max(returned value, v)

Page 14: Atomic snapshots in  O (log³ n) steps using randomized helping

14

Reading the Max-Register

0

read

1

1…TS:

…HELP:

…POINTER:

read

pi

read (returns v, ts[j])

pj

read (returns i)

+1

(random)

size n3

(logarithmic no. of steps)

if ts[j]==TS[j] return v

Main argument:many read steps

many fresh values in pointer array, whp

Page 15: Atomic snapshots in  O (log³ n) steps using randomized helping

15

2-Component Max Array

write0(v)

read

update first max-register

read both max-registers

write1(v)update second max-register

Page 16: Atomic snapshots in  O (log³ n) steps using randomized helping

16

Max Array Implementation

switch = 0

switch = 0 switch = 0

value 0 value 1

value v value v’

… ……

write0(v)

readMax1

Max1 Max1

Max1 Max1

Max1 Max1

write1(v) Max1

Max1

Max1

Page 17: Atomic snapshots in  O (log³ n) steps using randomized helping

17

Randomized 2-Component Max Array

switch = 0

switch = 0

switch = 0

write(v)

switch = 1

switch = 1 Max1

Max1Max1

Max1

Max1 Max1

Max1

Max1

Max1

Problem: readers do not travel all the way

from root to valueMax1

Max1Max1

Solution: read Max at root instead of Max at

previous location

Page 18: Atomic snapshots in  O (log³ n) steps using randomized helping

18

Summary

Randomized snapshot in O(log3n) steps whp

Main Technique: Randomized helping

Open problems:– Snapshot implementations using single-writer registers– Additional randomized implementations– Randomized lower bounds

Thank you! Questions?