Download presentation
Presentation is loading. Please wait.
1
Buffer Management ID: 102 CS257 Spring 2008 Instructor: Dr.Lin
2
Contents Buffer Management Architecture Buffer Management Strategies Relationship Between Physical Operator Selection and Buffer Management Algorithms Using More Than Two Passes
3
Buffer Management Buffers use to store needed data Numbers of buffers depend on system conditions Responsibility to allow processes to get the memory Minimizing the delay and unsatisfiable requests
4
Buffer Management Architecture Two Architectures: In real main-memory reserved for the database, or In virtual memory Many “main-memory” DBMS’s and “object- oriented” DBMS’s operate this way
5
Buffer Management Strategies Buffer-Replacement Strategies Least-Recently Used (LRU) First-In-First-Out (FIFO) The “Clock” Algorithm (“Second Chance”) System Control
6
Least-Recently Used (LRU) For each page in buffer pool, keep track of time when last read or write Replace the frame which has the oldest (earliest) time Very common policy: intuitive, simple and effective
7
First-In-First-Out (FIFO) Know the time the block was loaded into the buffer Less maintenance than LRU
8
The “Clock” Algorithm An approximation of LRU Arranged in a circle
9
Relationship Between Physical Operator Selection and Buffer Management Physical operators may ask: Can the algorithm adapt to changes value of M How does the buffer-replacement strategy used by the buffer manager impact the number of additional I/O ’ s that must be performed
10
Other Algorithms Sort-based algorithm Main-memory sorting LRU FIFO Hash-based algorithm
11
Algorithms Using Passes Largest relations Process relations of arbitrary size Both sort- and hash-based approaches
12
Multipass Sort-based Algorithms Suppose M buffers, relation R R fits in M blocks, read R into main memory R does not fit into main memory partition the blocks into M groups Merge M sorted sublists Read M sublists, each into one buffer
13
Multipass Hash-Based Algorithm Used for large relations Suppose we have M memory We hash relation R to M-1 buckets, and relation S to M-1 buckets (same hash function)
14
Multipass Hash-Based Algorithm (cont’d) For each bucket, we use another hash function to hash each bucket to smaller buckets (R and S use the same hash function) Recursive process, until each pair of partitions fit into memory
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.