160 likes | 253 Views
Cache-Oblivious Implicit Predecessor Dictionaries with the Working-Set Property Casper Kejlberg-Rasmussen Joint work with Gerth Stølting Brodal. Outline. Problem Definitions Previous Results An Implicit Moveable Dictionary An Implicit Dictionary with the Working-Set Property.
E N D
Cache-Oblivious Implicit Predecessor Dictionarieswith the Working-Set PropertyCasper Kejlberg-RasmussenJoint work withGerthStøltingBrodal
Outline • Problem Definitions • Previous Results • An Implicit Moveable Dictionary • An Implicit Dictionary with the Working-Set Property
Problem Definitions • Implicit model: • All operations from the RAM • It is not allowed to create words, only to move them • All n words have to be in continuous positions • Often it is assumed that all elements are distinct • Fundamental trick: encode a bit in a pair of elements 1 n ... 0, if x=min(x,y) x y b= 1, if x=max(x,y) b
Problem Definitions • Element e has a working-set number of le iff: le elements different from e have been searched for since we last searched for e • An Implicit Dictionary with the Working-Set Property: • Insert(e): insert element e into the dictionary and set le =0 • Delete(e): delete element e from the dictionary • Search(e): determine if e is in the dictionary and set le =0 • Predecessor(e): find the address of the predecessor of e • Successor(e): find the address of the successor of e le : 0 1 2 3 4 5 1 2 3 4 4 5 6
Outline • Problem Definitions • Previous Results • An Implicit Moveable Dictionary • An Implicit Dictionary with the Working-Set Property
Previous Results e* is the predecessor/successor of e
Outline • Problem Definitions • Previous Results • An Implicit Moveable Dictionary • An Implicit Dictionary with the Working-Set Property
An Implicit Moveable Dictionary • A implicit moveable dictionary laid out in memory addresses [i;j] • Interface: • Insert-left/right(e): insert element e into the dictionary which grows to the left/right • Delete-left/right(e): delete element e from the dictionary which shrinks from the left/right • Search(e): finds the address of e if e is in the dictionary • Predecessor(e): finds the address of the predecessor of e • Successor(e): finds the address of the successor of e i j i-1
An Implicit Moveable Dictionary • Uses O(1) FG dictionaries as black boxes • Recall the FG interface: • Insert-right(e): insert element e into the dictionary which grows to the right • Delete-right(e): delete element e from the dictionary which shrinks from the right • Search(e): finds the address of e if e is in the dictionary • Predecessor(e): finds the address of the predecessor of e • Successor(e): finds the address of the successor of e L C R
An Implicit Moveable Dictionary • L and R will shrink and grow over time • L/R might get too small • L/R might get too large compared to C • We introduce the notion of jobs • Grow-left/right – Counters when L/R gets too small • Shrink-left/right – Counters when L/R gets too large • Jobs run O(1) steps every operation: searches, updates L C R
An Implicit Moveable Dictionary L C R L C R Address-mapping L L’ C R L L’ C R i j L L’ C R L L’ C R Shrink-left Grow-left L L’ C R L L’ C R k k’ i i’ L L’ C R L L’ C R L C R L C R
Outline • Problem Definitions • Previous Results • An Implicit Moveable Dictionary • An Implicit Dictionary with the Working-Set Property
An Implicit Dictionary with theWorking-Set Property • Exponential layout • Bi consists of O(1) moveable dictionaries • All elements e in Bi have le ≥22i-1+k or le ≥22i+k • Searched and inserted elements are moved into B0 (overflows) • These are the ideas we used in the ISAAC 2010 paper • Only gives O(log n) bounds for predecessor and successor searches: invariants do not relate e and its prede/succ-essor |Bi|=Θ(22i+k) m=O(loglog n) B0 B1 B2 Bi Bm-1 Bm ... ...
An Implicit Dictionary with theWorking-Set Property • Divide the key-space into mutually disjoint intervals aligned with the points/elements • Invariant: any point/element, intersecting an interval at level i, lies in block Bi • Predecessor/Successor(e) searches can terminate when an interval at level i is intersected • Intervals to solve the predecessor and successor problems Bm Bm-1 ... B2 B1 B0 e
An Implicit Dictionary with theWorking-Set Property • Representing the intervals implicitly Bm Bm-1 ... B2 B1 B0 Di Ai Ri Wi Hi Ci Gi Bi-1 Bi+1 Arriving Resting Waiting Guarding Climbing Helping le ≥22i+k le ≥22max(i,j)-1+k le ≥22i-1+k
Thank you • References • Cache-Oblivious Implicit Predecessor Dictionaries with the Working-Set Property • GerthStøltingBrodal, Casper Kejlberg-Rasmussen • Submitted to STACS 2012 • Available at cs.au.dk/~ckr/papers/STACS2012_Submission.pdf • A Cache-Oblivious Implicit Dictionary with the Working Set Property • Gerth Stlting Brodal, Casper Kejlberg-Rasmussen, Jakob Truelsen • ISAAC 2010