Buffer Management - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Buffer Management

Description:

Implementing the Buffer Pool ... hash page_id via buffer table hash function; ... Buffer pool. Relation r. Relation s. John Sieg, UMass Lowell ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 10
Provided by: john131
Category:

less

Transcript and Presenter's Notes

Title: Buffer Management


1
Buffer Management
  • Idea Minimize the amount of disk I/O by keeping
    likely-to-be-requested pages in memory (buffer
    frames)

John Sieg, UMass Lowell
2
Relationship to Other DBMS Modules
  • 1. Request record.
  • 2. Fix page.
  • 3. Retrieve page into buffer.
  • 4. Access memory by memory address.

John Sieg, UMass Lowell
3
Buffer Manager API
  • mem_loc FIX(in page_id)
  • fixed pages never victimized
  • There can be multiple fixes on a single page.
  • Address translation for page is done once, not
    many times.
  • UNFIX(in page_id)
  • issued soon after FIX
  • Page may remain in buffer
  • Flush(in list of pages)
  • needed for atomic recovery

John Sieg, UMass Lowell
4
Implementing the Buffer Pool
  • Header records can be statically allocated as an
    array, aligned with buffers.
  • Why hash table?

John Sieg, UMass Lowell
5
FIX()
memory_address_type FIX (page_id_type page_id)
memory_address_type buffer_address
buffer_record_type buffer_record hash
page_id via buffer table hash function
traverse hash bucket, looking for page_id's
buffer record if (page identified by page_id
has a buffer record buffer_record)
buffer_address use_resident_copy(buffer_record)
else if free_list is non-empty
buffer_address use_free_buffer(page_id)
else if look_aside_list is non-empty
buffer_address victimize_a_look_aside_buffer(pag
e_id) else // There are no unfixed buffers.
handle overcommitment of buffer pool
return buffer_address
John Sieg, UMass Lowell
6
Buffer Pools Compared to File Caches
  • Both services hidden from upper layers
  • Both cache disk pages in memory and maintain
    look-aside lists
  • File cache managers do not support FIX (why?)
  • Replacement policies and prefetching techniques
    are more effective in buffer managers.
  • File cache managers provide little support for
    recovery.

John Sieg, UMass Lowell
7
Replacement Policies
  • Only UNFIXed pages (the look-aside list) are
    subject to replacement.
  • Motivation Keep in buffers the pages most likely
    to be referenced
  • Policies
  • LRU (least recently UNFIXed)
  • Clock
  • newer policies that use DBMSs knowledge of
    reference string

John Sieg, UMass Lowell
8
Clock Replacement Policy
John Sieg, UMass Lowell
9
Why It Pays to be Clever
foreach tuple tr of relation r do foreach
tuple ts of relation s do output
concat(tr, ts)
Buffer pool
Relation r
Relation s
John Sieg, UMass Lowell
Write a Comment
User Comments (0)
About PowerShow.com