2079 11

CSC265 ยท 2079 ยท 5 marks

What is Buffer Management in DBMS? Explain.

What is Buffer Management in DBMS? Explain. [5]

Database Management SystemChapter 10: Database Recovery TechniquesRecovery Concepts

Quick answer

Buffer Management refers to the process by which the DBMS manages a collection of in-memory buffers (called the DBMS cache) that temporarily hold disk pages (blocks) containing data items needed for processing. Since disk I/O is slow, the DBMS brings data into main memory buffers, performs operations there, and then writes the modified data back to disk at an appropriate time.

Buffer Management in DBMS

Definition


How Buffer Management Works

When a transaction needs to read or update a data item, the DBMS follows these steps:

  1. Check the buffer directory to see if the required disk page is already in the DBMS cache (buffer pool).
  2. If not present, the page is fetched from disk into a free buffer slot.
  3. The data item is updated in memory (not directly on disk).
  4. A dirty bit is associated with each buffer:
    • Dirty bit = 0: the buffer has not been modified.
    • Dirty bit = 1: the buffer has been modified and needs to be written back to disk.
  5. Eventually, the modified buffer is written back to disk based on the recovery policy in use.

Key Policies in Buffer Management

Buffer management is closely tied to recovery algorithms. Two important policy pairs govern when modified pages are written to disk:

1. Steal / No-Steal Policy

PolicyDescription
No-StealA buffer page updated by a transaction cannot be written to disk before the transaction commits.
StealThe protocol allows writing an updated buffer to disk before the transaction commits.

2. Force / No-Force Policy

PolicyDescription
ForceAll pages updated by a transaction are immediately written to disk before the transaction commits.
No-ForceUpdated pages are not necessarily written to disk at commit time; they may be written later.

Role of the DBMS Cache Directory

  • A directory is maintained to track which database pages are currently held in the buffer pool.
  • This avoids redundant disk reads if the same page is needed again.
  • The DBMS recovery subsystem uses this information to manage undo and redo operations during crash recovery.

Importance of Buffer Management

  • Reduces the number of expensive disk I/O operations.
  • Ensures data consistency by controlling when dirty pages are flushed to disk.
  • Supports transaction recovery by coordinating with logging mechanisms (undo/redo logs).
  • Works together with checkpointing, where all modified buffers are force-written to disk to establish a consistent recovery point.

Summary

Buffer management is the mechanism by which the DBMS controls a pool of main memory buffers (DBMS cache) to hold disk pages temporarily, tracks modifications using dirty bits and a directory, and applies steal/no-steal and force/no-force policies to decide when to write data back to disk, thereby balancing performance and recoverability.

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.