resilient priority queue

25
Resilient Priorirty Queue Anirban Mitra [email protected] Department of Computer Science Stony Brook University March 30, 2013 Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 1 / 25

Upload: anirban-mitra

Post on 13-Dec-2014

1.129 views

Category:

Documents


0 download

DESCRIPTION

 

TRANSCRIPT

Page 1: Resilient priority queue

Resilient Priorirty Queue

Anirban Mitra

[email protected] of Computer Science

Stony Brook University

March 30, 2013

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 1 / 25

Page 2: Resilient priority queue

Memory Errors

One or more Memory bits is read differently from last written values

Causes can be hardware bit corruption, cosmic rays, corruption inpath between memory and CPU

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 2 / 25

Page 3: Resilient priority queue

Pointer Corruptions

Figure : Even a single memory corruption can be catastrophic. A simple linkedlist with memory error, entire tail lost due to a single pointer corruption

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 3 / 25

Page 4: Resilient priority queue

ECC

Hardware ECC (Error Correcting Codes) chips can help

But is expensive in terms of processing time and money

Even ECC cannot correct every corruption

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 4 / 25

Page 5: Resilient priority queue

Its Not Rare

Figure : A field study by Google researchers

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 5 / 25

Page 6: Resilient priority queue

Resilient Algorithms

Make the algorithm and data structure capable of dealing withmemory errors

Design for damage control, minimize the disasters

Memory model assumes that at maximum δ corruptions throughoutthe runtime

δ is an input to the model, known in advance

Also, assumes that it has some constant amount of relaible memoryP = O(1)

Relaible memory cannot get corrupt

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 6 / 25

Page 7: Resilient priority queue

Faithful Ordering

In resilient sorting, recovery from corruption is expensive

Hence goal is modified to all un-corrupted items are guaranteed to becorrectly sorted

Order of corrupted items is ignored

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 7 / 25

Page 8: Resilient priority queue

Resilient Merging

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 8 / 25

Page 9: Resilient priority queue

Structure of Resilient Priority Queue

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 9 / 25

Page 10: Resilient priority queue

Structure of Resilient Priority Queue

Intuitively, elements in Up buffer are moving to upper layers

Elements in Down buffer are moving to lower layers

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 10 / 25

Page 11: Resilient priority queue

Structure of Resilient Priority Queue

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 11 / 25

Page 12: Resilient priority queue

Invariant A

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 12 / 25

Page 13: Resilient priority queue

Invariant B

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 13 / 25

Page 14: Resilient priority queue

Invariant C - Down at least Half Filled

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 14 / 25

Page 15: Resilient priority queue

Invariant D - Up at most Half Filled

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 15 / 25

Page 16: Resilient priority queue

Insert

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 16 / 25

Page 17: Resilient priority queue

Insert

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 17 / 25

Page 18: Resilient priority queue

Insert

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 18 / 25

Page 19: Resilient priority queue

Push and Pull

Push and Pull primitives used fro Insert and DeleteMin

Push pushes elements to higher layers when Up at most half invariantis broken

Similarly, Pull pulls elements from higher layer when Down at leasthalf invariant is broken

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 19 / 25

Page 20: Resilient priority queue

Algorithm for Push

1: function Push(Ui )2: di = |Di |3: M = Ui ∪ Di ∪ Ui+1

4: Di = M[0..(di − δ)]5: Ui = []6: if i = k then7: Uk+1 = []8: Dk+1 = M[(di − δ)..]9: k = k+1

10: else11: Ui+1 = M[(di − δ)..]

12: if Ui+1 > si+1/2 then13: Push(Ui+1)

14: if Di < si/2 then15: Pull(Di )

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 20 / 25

Page 21: Resilient priority queue

Algorithm for Pull

1: function Pull(Di )2: di = |Di |3: di+1 = |Di+1|4: M = Ui ∪ Di ∪ Ui+1

5: Di = M[0..si ]6: Di+1 = [si ..(di+1 + di − δ)]7: Ui+1 = [di+1 + di − δ..]8: if Ui+1 > si+1/2 then9: Push(Ui+1)

10: if Di+1 < si+1/2 then11: Pull(Di+1)

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 21 / 25

Page 22: Resilient priority queue

Insert

For insertion we maintain a buffer I of size (δ + logn + 1) and simplyappend the new element to buffer

When I is full we faithfully sort it and faithfully merge with U0

Call Push on U0 if at most invariant is broken

For DeleteMin return the minimum of the first δ + 1 elements of D0

and all of I

if D0 underflows, call Pull

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 22 / 25

Page 23: Resilient priority queue

Complexity

Insert and DeleteMin takes O(logn + δ) amortized time

Push and Pull on a buffer is called at most once each request

Intuitively, Ω(si ) operations happen between any two call at any levelLi which gives the amortized bounds

Lower bound is proved to be the same

Uses O(n + δ) space

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 23 / 25

Page 24: Resilient priority queue

Relation with Cache Oblivious

This structure was inspired by cache oblivious priority queue byBender et al in 2002

There are several data structures which are adpated from their cacheoblivious versions

Even though resilient model does not have memory hierarchy

One reason could be that cache oblivious structure use chunks ofarray to gain by locality and employs less pointers

So they become amenable to be adapted to resilient version becausethen the small number of pointers can be stored in reliable memory

Note that there is a tree based cache oblivious priority queue too

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 24 / 25

Page 25: Resilient priority queue

References

L. Arge, M. A. Bender, E. D. Demaine, B. Holland-Minkley, and J. I.Munro. Cache-oblivious priority queue and graph algorithmapplications. In Proc. of the 34th Annual ACM Symposium onTheory of Computing, pages 268-276, 2002.

I. Finocchi, F. Grandoni, and G. F. Italiano. Optimal resilientsortingand searching in the presence of memory faults. In Proceedingsof the 33rd International Colloquium on Automata, Languages andProgramming, volume 4051 of Lecture Notes in Computer Science,pages 286-298. Springer, 2006

A. G. Jorgensen. Data Structures: Sequence Problems, RangeQueries and Fault Tolerance. PhD Dissertation, Aarhus University,Department of Computer Science, Denmatk, pages 79-87, 2010.

Anirban Mitra (SBU) Resilient Priorirty Queue March 30, 2013 25 / 25