Lower Bounds for External Memory Dictionaries Gerth Stlting Brodal - - PowerPoint PPT Presentation

lower bounds for external memory dictionaries
SMART_READER_LITE
LIVE PREVIEW

Lower Bounds for External Memory Dictionaries Gerth Stlting Brodal - - PowerPoint PPT Presentation

Lower Bounds for External Memory Dictionaries Gerth Stlting Brodal Rolf Fagerberg BRICS University of Aarhus Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms Baltimore, MD, USA, January 13, 2003 1 Dictionary Queries


slide-1
SLIDE 1

Lower Bounds for External Memory Dictionaries

Gerth Stølting Brodal Rolf Fagerberg

BRICS

University of Aarhus

Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms Baltimore, MD, USA, January 13, 2003

1

slide-2
SLIDE 2

Dictionary

  • Queries

– membership – predecessor / successor – range queries . . .

  • Updates

– insertions – deletions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

2

slide-3
SLIDE 3

Dictionary

  • Queries

– membership – predecessor / successor – range queries . . .

  • Updates

– insertions – deletions This talk : Comparison based, membership, insertions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

2

slide-4
SLIDE 4

Dictionaries – Comparison Based

Insert Search Balanced search trees O(log N) O(log N)

Insert log N log N Search

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

3

slide-5
SLIDE 5

Dictionaries – Comparison Based

Insert Search Balanced search trees O(log N) O(log N) Adversary ∞ ⇒ Ω(log N)

Insert log N log N Search

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

3

slide-6
SLIDE 6

Dictionaries – Comparison Based

Insert Search Balanced search trees O(log N) O(log N) Adversary ∞ ⇒ Ω(log N) Borodin et al. 1982 O(t) ⇒ N/2O(t)

Insert log N log N Search

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

3

slide-7
SLIDE 7

External Memory Model

Aggarwal and Vitter 1988

CPU External M y r

  • m

e I/O Memory I n t e r n a l

N = problem size M = memory size B = I/O block size

  • One I/O moves B consecutive records from/to disk
  • Cost : number of I/Os
  • Elements can be copied and compared in internal memory

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

4

slide-8
SLIDE 8

B-trees

– An External Memory Dictionary

Bayer and McCreight 1972

  • · · ·

O(B)

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

5

slide-9
SLIDE 9

B-trees

– An External Memory Dictionary

Bayer and McCreight 1972

O (logB M) O

  • logB

N M

  • Memory

External Memory Internal

                 

  • · · ·

O(B)

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

5

slide-10
SLIDE 10

B-trees

– An External Memory Dictionary

Bayer and McCreight 1972

O (logB M) O

  • logB

N M

  • Memory

External Memory Internal

                 

  • · · ·

O(B) Search/update path

Insert Membership

  • O
  • logB

N M

  • I/Os

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

5

slide-11
SLIDE 11

Dictionaries – External Memory

Insert Search B-trees O(logB

N M )

O(logB

N M )

Insert logB

N M

Search logB

N M

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

6

slide-12
SLIDE 12

Dictionaries – External Memory

Insert Search B-trees O(logB

N M )

O(logB

N M )

Adversary ∞ ⇒ Ω(logB

N M )

Insert logB

N M

Search logB

N M

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

6

slide-13
SLIDE 13

Dictionaries – External Memory

Insert Search B-trees O(logB

N M )

O(logB

N M )

Adversary ∞ ⇒ Ω(logB

N M )

?

Insert logB

N M

Search logB

N M

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

6

slide-14
SLIDE 14

Comparisons vs. I/Os

Insert log N log N Search

?

Insert logB

N M

Search logB

N M

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

7

slide-15
SLIDE 15

Comparisons vs. I/Os

Insert log N log N Search

?

Insert logB

N M

Search logB

N M

Sorting Comparisons Θ(N log N) I/Os Θ( N

B logM/B N M ) Aggarwal and Vitter 1988

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

7

slide-16
SLIDE 16

Comparisons vs. I/Os

Insert log N log N Search

Sorting threshold

? ?

threshold Sorting 1 B logM/B N M

Insert logB

N M

Search logB

N M

Sorting Comparisons Θ(N log N) I/Os Θ( N

B logM/B N M ) Aggarwal and Vitter 1988

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

7

slide-17
SLIDE 17

Results

Θ(logδ

N M )

B-trees

Insert δ Search

Sorting Threshold

N/(M · (M

B )Θ(δ))

δ = number of I/Os for B insertions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

8

slide-18
SLIDE 18

Results

Θ(logδ

N M )

B-trees

Insert δ Search

Sorting Threshold

N/(M · (M

B )Θ(δ))

B-trees Buffered 1 ε logB N M Bε ε logB N M

δ = number of I/Os for B insertions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

8

slide-19
SLIDE 19

Results

Θ(logδ

N M )

B-trees

Insert δ Search

Sorting Threshold

N/(M · (M

B )Θ(δ))

B-trees Buffered 1 ε logB N M Bε ε logB N M

logB

N M

Θ(logM/B

N M )

log1+ε N B/ log3 N B logB

N M

δ = number of I/Os for B insertions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

8

slide-20
SLIDE 20

Buffered B-trees

– how to speedup B-tree updates by a factor B1−ε

Memory External Memory Internal

· · ·

Searches O( 1

ε logB N M )

B insertions O( Bε

ε logB N M )

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

9

slide-21
SLIDE 21

Buffered B-trees

– how to speedup B-tree updates by a factor B1−ε

Memory External Memory Internal O

1

ε logB M

  • O

1

ε logB N M

  • O(Bε)

                 

  • · · ·

Searches O( 1

ε logB N M )

B insertions O( Bε

ε logB N M )

  • B-tree with degree Θ(Bε)

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

9

slide-22
SLIDE 22

Buffered B-trees

– how to speedup B-tree updates by a factor B1−ε

Memory External Memory Internal O

1

ε logB M

  • O

1

ε logB N M

  • O(Bε)

                 

  • · · ·

Buffer

Searches O( 1

ε logB N M )

B insertions O( Bε

ε logB N M )

  • B-tree with degree Θ(Bε)
  • Buffers of O(B) delayed insertions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

9

slide-23
SLIDE 23

Buffered B-trees

– how to speedup B-tree updates by a factor B1−ε

Memory External Memory Internal O

1

ε logB M

  • O

1

ε logB N M

  • O(Bε)

                 

  • · · ·

Search path

Buffer

Searches O( 1

ε logB N M )

B insertions O( Bε

ε logB N M )

  • B-tree with degree Θ(Bε)
  • Buffers of O(B) delayed insertions

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

9

slide-24
SLIDE 24

Buffered B-trees

– how to speedup B-tree updates by a factor B1−ε

Memory External Memory Internal O

1

ε logB M

  • O

1

ε logB N M

  • O(Bε)

                 

  • · · ·

Search path

Buffer

Searches O( 1

ε logB N M )

B insertions O( Bε

ε logB N M )

  • B-tree with degree Θ(Bε)
  • Buffers of O(B) delayed insertions
  • On buffer overflow move O(B1−ε)

elements to a child with one I/O

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

9

slide-25
SLIDE 25

Lower Bound

– optimality of buffered B-trees SK S3 S2 S1 · · ·

insert time

S1 S2 Sj SK 1 2 3

N 2

· · ·

  • rdering

· · · i xij ≈ i

  • Adversary online constructs S1, . . . , SK
  • Constructs i such that xij has not been in internal memory

since Sj was inserted, for all j = 1, . . . , K

  • xi1, . . . , xiK form an antichain, i.e. search requires ≥ K I/Os

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

10

slide-26
SLIDE 26

Lower Bound (Cont.)

insert time

Sj Sj+1 Construct Sj+1

  • Let ˆ

I be the indexes i where – xij ∈ Sj but is not in internal memory after inserting Sj – xi1, . . . , xi(j−1) have not been read into internal memory by the δ |Sj|

B I/Os during the insertion of Sj

  • Construct I ⊂ ˆ

I such that all blocks in external memory contain O( B

δ ) elements xij where i ∈ I

– Existence by randomized sampling with probability O(1/δ) and Chernoff bounds, provided B/δ = Ω(log N)

  • Let xi(j+1) ∈ Sj iff i ∈ I

K = Θ(logδ

N M )

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

11

slide-27
SLIDE 27

Lower Bound — Below Sorting

Insert Search δ B ⇒ N M ·

  • M

B

Θ(δ)

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

12

slide-28
SLIDE 28

Lower Bound — Below Sorting

Insert Search δ B ⇒ N M ·

  • M

B

Θ(δ)

  • W.l.o.g. memory and each block totally ordered after each I/O

N log M + δN B

  • B log M

B

  • comparisons

Insert in internal memory Merging a block with internal memory

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

12

slide-29
SLIDE 29

Lower Bound — Below Sorting

Insert Search δ B ⇒ N M ·

  • M

B

Θ(δ)

  • W.l.o.g. memory and each block totally ordered after each I/O

N log M + δN B

  • B log M

B

  • comparisons

Insert in internal memory Merging a block with internal memory

  • Antichain of size (Borodin et al. 1982 / Dillworth’s lemma)

N 2log M+δ log M

B

= N M ·

  • M

B

δ

  • f which all elements except one are in distinct blocks

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

12

slide-30
SLIDE 30

Conclusion

Θ(logδ

N M )

B-trees

Insert δ Search

Sorting Threshold

N/(M · (M

B )Θ(δ))

B-trees Buffered 1 ε logB N M Bε ε logB N M

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

13

slide-31
SLIDE 31

Conclusion

Θ(logδ

N M )

B-trees

Insert δ Search

Sorting Threshold

N/(M · (M

B )Θ(δ))

B-trees Buffered 1 ε logB N M Bε ε logB N M

logB

N M

Θ(logM/B

N M )

log1+ε N B/ log3 N B logB

N M

Brodal, Fagerberg: Lower Bounds for External Memory Dictionaries

14