18
One-Shot Snapshots in Space Helmi, Higham, Pacheco and Woelfel (Best paper PODC 2011)

One-Shot Snapshots in Space

  • Upload
    jacqui

  • View
    42

  • Download
    0

Embed Size (px)

DESCRIPTION

One-Shot Snapshots in Space. Helmi , Higham , Pacheco and Woelfel (Best paper PODC 2011). Some Space Bounds (# Registers). Getting Below the Obvious . R[1,..,n/2]. 1. getTS p sum = 0 for i = 1 to if i == R[ i ] = R[ i ]+1 sum = sum + R[ i ] return su m. 2. - PowerPoint PPT Presentation

Citation preview

Page 1: One-Shot Snapshots  in   Space

One-Shot Snapshots in Space

Helmi, Higham, Pacheco and Woelfel(Best paper PODC 2011)

Page 2: One-Shot Snapshots  in   Space

Upper Bound Lower BoundLeader election

One-shot timestamps

Binary consensus

Id consensus

Long-lived timestamps

Some Space Bounds (# Registers)

Page 3: One-Shot Snapshots  in   Space

Getting Below the Obvious getTSp

sum = 0for i = 1 to

if i == R[i] = R[i]+1

sum = sum + R[i]return sum

R[1,..,n/2]1

2

The value of each R[i]changes 0 1 2(it could change 0 1 only , but not 2 1)

I.e., value of each R[i]is monotonesum is also monotoneTimestamps increase with time

Page 4: One-Shot Snapshots  in   Space

Getting to Space

Pack processes in each entryEntry k used only after k “rounds”

A timestamp is a pair • round in which it was taken• turn orders within a round

Timestamps compared by lexical order

R[1,.., ]

Page 5: One-Shot Snapshots  in   Space

Data Structures

RA shared array R[1,.., ] with entries or

Each process also has:Local copy r[1,.., ]And two indexes myrnd, j

⊥ r

1j

sequence of process ids

1myrnd

Page 6: One-Shot Snapshots  in   Space

The Algorithm (for Process p)while R[j] r[j] = R[j] ; j++myrnd = j-1for j = 1 to myrnd-1 if R[myrnd+1] return if r[myrnd].seq[j] == last(R[j].seq) R[j] = ; if R[j].rnd < myrnd R[j] = r[1..m] = DoubleCollect(R[1..m])if R[myrnd+1] == R[myrnd+1] = return

r R

return

repeatedly read R[], until two equal collects

(r,p,q)

(z)

,_(p)

Page 7: One-Shot Snapshots  in   Space

Step Complexitywhile R[j] r[j] = R[j] ; j++myrnd = j-1for j = 1 to myrnd-1 if R[myrnd+1] return if r[myrnd].seq[j] == last(R[j].seq) R[j] = ; if R[j].rnd < myrnd R[j] = r[1..m] = DoubleCollect(R[1..m])if R[myrnd+1] == R[myrnd+1] = return

(1,0)

return

O(m) iterationsO(1) steps / iteration O(m) steps

≤ m writes / getTS O(m n) writes total

O(m) steps / iterationO(m n) iterations O(m2n) steps

Altogether O(m2n) = O(n2) steps

Page 8: One-Shot Snapshots  in   Space

Basic Propertieswhile R[j] r[j] = R[j] ; j++myrnd = j-1for j = 1 to myrnd-1 if R[myrnd+1] return if r[myrnd].seq[j] == last(R[j].seq) R[j] = ; if R[j].rnd < myrnd R[j] = r[1..m] = DoubleCollect(R[1..m])if R[myrnd+1] == R[myrnd+1] = return

R

(1,0)

1. Once R[j] it stays non-2. If R[j] then i < j, R[i] 3. The values written to

last(R[j].seq) are distinct4. If getTS returns (j,_) then R[j]

return

Page 9: One-Shot Snapshots  in   Space

Timestamp Property

Assume processes don’t fall off the arraygetTSp returns getTSq returns

By basic facts (and many subcases), So assume

1. Once R[j] it stays non-2. If R[j] then i < j, R[i] 3. The values written to

last(R[j].seq) are distinct4. If getTS returns (j,_) then R[j]

getTSp precedes getTSq

Page 10: One-Shot Snapshots  in   Space

Timestamp Propertywhile R[j] r[j] = R[j] ; j++myrnd = j-1for j = 1 to myrnd-1 if R[myrnd+1] return if r[myrnd].seq[j] == last(R[j].seq) R[j] = ; if R[j].rnd < myrnd R[j] = r[1..m] = DoubleCollect(R[1..m])if R[myrnd+1] == R[myrnd+1] = return

R

(1,0)

A

B

C

return

Page 11: One-Shot Snapshots  in   Space

Space Complexity Proof: Phases

Partition the execution into phases– Phase 0 starts at the beginning of the execution– Phase starts when the double collect of the first

process with myrnd = is linearized– Phase completes when phase starts

phase 0 phase 1 phase phase

Page 12: One-Shot Snapshots  in   Space

Additional Basic Propertieswhile R[j] r[j] = R[j] ; j++myrnd = j-1for j = 1 to myrnd-1 if R[myrnd+1] return if r[myrnd].seq[j] == last(R[j].seq) R[j] = ; if R[j].rnd < myrnd R[j] = r[1..m] = DoubleCollect(R[1..m])if R[myrnd+1] == R[myrnd+1] = return

R

(1,0)

1. R[j] is changed to non- only in Z2. getTSp executes Z in phase myrndp+13. getTSp executes W in phase myrndp

X

Y

Z

W

return

Page 13: One-Shot Snapshots  in   Space

Space Complexity Proof: Overview

The first write to R[j] in a phase is an invalidationExactly invalidations if phase completesWe prove that #invalidations

1. R[j] is changed to non- only in Z2. getTSp executes Z in phase myrndp+13. getTSp executes W in phase myrndp

Exactly registers R[1],…,R[ ] are written in phase

phase 0 phase 1 phase phase

Page 14: One-Shot Snapshots  in   Space

Space Complexity Proof: Charging

Map invalidations to writes, such that– Mapping is one-to-one, and – Onto at most two writes of the same getTS

#invalidations

phase 0 phase 1 phase phase

Page 15: One-Shot Snapshots  in   Space

Mapping Invalidationswhile R[j] r[j] = R[j] ; j++myrnd = j-1for j = 1 to myrnd-1 if R[myrnd+1] return if r[myrnd].seq[j] == last(R[j].seq) R[j] = ; if R[j].rnd < myrnd R[j] = r[1..m] = DoubleCollect(R[1..m])if R[myrnd+1] == R[myrnd+1] = return

R

return

(1,0)

An invalidation is mapped to:• Itself if it is the first invalidation or

last write of getTS (self map) or • The write that wrote the value it

read before the invalidation

X

Y

Z

W

Page 16: One-Shot Snapshots  in   Space

Space Complexity Proof: Charging

Map invalidations to writes, s.t.Mapping is one-to-one, and

Non-self maps are not onto invalidationsTwo invalidations are not mapped to same write(They cannot read the same value and both be invalidations.)

Page 17: One-Shot Snapshots  in   Space

Space Complexity Proof: Charging

Map invalidations to writes, s.t.Mapping is one-to-one, and Onto at most two writes of the same process

If non-self map onto a write, then this write is the final one of the process & it is not an invalidation

Page 18: One-Shot Snapshots  in   Space

Opportunities

• Space requirements grow as , but lower bound needs exponential #invocations– More graceful degradation?

• Adaptive space requirements for other problems? (E.g., max registers.)

• Step complexity? Polylog(#invocations)?– Avoid scan (double collect)?– Use a better snapshot?