1 / 40

Cache-Oblivious Dynamic Dictionaries with Optimal Update/Query Tradeoff

Indeksstrukturer til Ekstern Hukommelse. Cache-Oblivious Dynamic Dictionaries with Optimal Update/Query Tradeoff. Gerth Stølting Brodal Aarhus University. Dansk Selskab for Datalogi, Frederiksbjerg , October 13, 2010. Gerth Stølting Brodal. Kurt Mehlhorn. 2007-. 1994-2006.

dora
Télécharger la présentation

Cache-Oblivious Dynamic Dictionaries with Optimal Update/Query Tradeoff

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Indeksstrukturer til Ekstern Hukommelse Cache-Oblivious Dynamic Dictionaries with Optimal Update/Query Tradeoff GerthStølting Brodal Aarhus University • Dansk Selskab for Datalogi, Frederiksbjerg, October 13, 2010

  2. GerthStølting Brodal Kurt Mehlhorn 2007- 1994-2006 Eric Meineche Schmidt PhD M.Sc. Associate Professor AU MPII MPII AU AU 1969 September 1983 September 1989 August 1993 January 1994 November 1997 January 1998 August 2004 April April M.Sc. Post Doc Faculty PhD

  3. Center of • Lars Arge, Professor, Centerleader • GerthS. Brodal, Associate Professor • 5 Post Docs, 10 PhD students, 4 TAP • Total budget for 5 years ca. 60 million DKR Frankfurt AU MIT MPII ArgeBrodal DemaineIndyk Mehlhorn Meyer

  4. Streaming Algorithms I/O Efficient Algorithms Cache Oblivious Algorithms Algorithm Engineering

  5. +

  6. The problem... Normal algorithm running time I/O-efficient algorithm input size bottleneck = memory size

  7. MemoryHierarchies CPU R Processor L1 L2 L3 Disk A M bottleneck increasing access times and memory sizes

  8. MemoryHierarkiesvs.Running Time L1 L2 L3 RAM køretid datastørrelse

  9. Memory Access Times

  10. read/write head read/write arm track magnetic surface Disk Mechanics • I/O is often bottleneck when handling massive datasets • Disk access is 107 times slower than main memory access! • Disk systems try to amortize large access time transferring large contiguous blocks of data • Need to store and access data to take advantage of blocks ! “The difference in speed between modern CPU and disk technologies is analogous to the difference in speed in sharpening a pencil using a sharpener on one’s desk or by taking an airplane to the other side of the world and using a sharpener on someone else’s desk.” (D. Comer)

  11. InternalMemoryIndex

  12. Bayer og McCreight (1971) B(oing)-Trees One node = one disk block HeightO(logBN)

  13. Internal memory B .... Search path B-trees -The Basic Searching Structure • Searches Practice: 4-5 I/Os • Repeated searching Practice: 1-2 I/Os

  14. The Bad News... Searchinganyexternalmemorydictionary (incl. B-trees) requiresworst-case Ω(logBN) I/Os Proofidea: ? x xxxxx x x xxxx x x N ≥(N - B) / (B + 1)

  15. Internal memory B .... Search path B-trees Best possible • Searches O(logBN) I/Os • UpdatesO(logBN) I/Os ?

  16. Brodal and Fagerberg (2003) d .... B-trees with Buffered Updates B x x x x • Searches cost • O(logdN) I/Os • = O(logBN ∙ 1/ε) I/Os 2 • N updates cost • O(N ∙ logdN ∙ d / B) I/Os • = O(N ∙ logBN ∙ 1/εB1-ε) I/Os = Bε 2 / √B Trade-offbetweensearch and update times – optimal !

  17. Brodal and Fagerberg (2003) B-trees with Buffered Updates

  18. Hedegaard (2004) B-trees with Buffered UpdatesExperimentalStudy • 100.000.000 elements • Search time basicallyunchangedwith buffers • 100 times faster updates

  19. Assumptionsuntilnow : B is known + onelevel is the bottleneck CPU R Processor L1 L2 L3 Disk A M bottleneck increasing access times and memory sizes

  20. Frigo, Leiserson, Prokop, Ramanchandran (1999) Cache-Obliviousnes Model CPU B R Processor L1 L2 L3 Disk A M M Algorithmdoes not knowB and M (assume optimal offline cache-replacementstrategy) increasing access times and memory sizes

  21. B A N I/O Efficient Scanning sum = 0 for i = 1 to N do sum = sum + A[i] O(N/B) I/Os

  22. Bayer og McCreight (1971) B(oing)-Trees One node = one disk block HeightO(logBN)

  23. Frigo (1999) RecursiveSearchTree Layout(Cache-Obliviousness) Searchesrequire O(logBN) I/Os (small subtrees have √B ≤ size≤ B, a pathtraverses at most 2∙logBN trees)

  24. Brodal, Fagerberg, Jacob (2002) Experiments : BinaryTree Layout

  25. Brodal, Fagerberg, Jacob (2002) Searcheswith Pointer Layout • van Emde Boas layout wins, followed by the BFS layout van Emde Boas layout

  26. Brodal, Fagerberg, Jacob (2002) Searcheswith Implicit Layout • BFS layout wins due to simplicity and caching of topmost levels • van Emde Boas layout requires quite complex index computations

  27. Brodal, Fagerberg, Jacob (2002) Searcheswith Pointer Layout - Beyond Main Memory • van Emde Boas layout wins, followed by the BFS layout

  28. Brodal, Fagerberg, Jacob (2002) Optimal Cache-ObliviousStaticIndex= van Emde Boas Layout of CompleteBinaryTree

  29. Cache-ObliviousDynamicIndex ?

  30. Brodal, Fagerberg, Jacob (2002) BinarySearchTreesDynamic • Embeda dynamic tree of small height into a complete tree • Static van Emde Boas layout • Rebuild data structure whenever N doubles or halves

  31. Brodal, Fagerberg, Jacob (2002) Brodal, Fagerberg, Jacob (2002) Andersson and Lai (1990) RebalancingSubtreeduringInsertion • If an insertion causes non-small height then rebuildsubtree at nearest ancestor with sufficient few descendants • Insertions require amortized time O(log2N)

  32. Brodal, Fagerberg, Jacob (2002) Optimal Cache-ObliviousDynamicIndex • Search O(logBN) I/Os (optimal) • Updates O(logBN + (log2N) / B) I/Os

  33. Cache-ObliviousIndexwithQuery-UpdateTrade-off ?

  34. Brodal, Demaine, Fineman, Iacono, Langerman, Munro (2010) Cache-ObliviousDynamicDictionarieswithQuery-UpdateTrade-off • Solution matching the I/O complexity of BufferedB-trees • Searches O(logBN ∙ 1/ε) I/Os • N updatesO(N ∙ logBN ∙ 1/εB1-ε) I/Os

  35. Brodal, Demaine, Fineman, Iacono, Langerman, Munro (2010) xDict … 221-box 222-box 22lglgN-box Insert • Insert into smallest box • When a box reaches capacity, Flush it and Batch-Insert into the next box Search • Search in each x-box • O(logBx) cost is dominated by largest box O(logBN)

  36. Brodal, Demaine, Fineman, Iacono, Langerman, Munro (2010) Batch insertx elements x-Box (capacity x2) size-x input buffer Upper level: at most x1/2/4 subboxes √x-box Flush size-x3/2 middle buffer Lower level: at most x /4 subboxes √x-box size-x2 output buffer Memory Layout … … input middle output subboxes stored contiguously in arbitrary order Unused (currently empty) subboxes are preallocated

  37. d .... ExternalMemoryIndex B … • Searches O(logBN ∙ 1/ε) I/Os • N updatesO(N ∙ logBN ∙ 1/εB1-ε) I/Os … = Bε

More Related