Course: Data Science and Database Technologies
Source: Buffer manager, local path 13-BufferManager.pdf, 20 PDF pages. The source credits Naeem Mahoto and presents DBMS material from the Data Base and Data Mining Group. Lecture number 13 follows the local course sequence and filename identifier.

Lecture summary

The buffer manager controls transfers of database pages between disk and the DBMS buffer in main memory. Keeping frequently used pages in memory avoids repeated disk I/O, while page state information prevents a page still in use from being replaced and records whether memory contains newer data than disk.

The lecture develops five operations. fix obtains a page for a transaction, unfix ends that use, set dirty records a modification, force writes synchronously, and flush writes suitable pages in the background. It then compares steal/no-steal victim policies and force/no-force commit policies. The usual steal/no-force combination improves efficiency but requires recovery to undo uncommitted writes and redo committed writes that had not reached disk.

Learning route

  1. Read Buffer Manager and Page Replacement for the complete page-state model and operation traces.
  2. Revisit DBMS Architecture and Query Processing for the buffer manager’s place in the larger DBMS pipeline.
  3. Revisit Transactions and ACID Properties to connect no-force and steal decisions to crash recovery.

Connected mechanism

A DBMS moves data in fixed-size pages. The buffer is a large, preallocated area of main memory shared by transactions. For each resident page, the buffer manager records its file identifier and block number, a Count of active users, and a dirty bit.

When a transaction calls fix(P), the manager first checks whether page P is already resident. If so, it returns the memory address and increments Count. If not, it chooses a free slot or a victim with Count = 0. A dirty victim is written to disk before replacement, then P is read into the buffer and returned.

When the transaction finishes, unfix(P) decrements Count. If it changed P, set dirty(P) marks the memory copy as newer than disk. force(P) waits for an immediate disk write. flush is internal background work that writes pages that are no longer valid for an active user or have not been accessed recently.

Source map

PDF pagesMaterial
2-6DBMS architecture, buffer purpose, pages, locality and page state
7-8Buffer-manager architecture and primitives
9-11fix and victim selection
12-15unfix, dirty state, force and flush
16-18Steal/no-steal and force/no-force
19-20File-system operations used by the buffer manager

Revision prompts

  • Trace fix, modification, set dirty, unfix and later replacement for one page.
  • Explain why a page with Count = 1 cannot be selected as a normal victim.
  • Compare steal/no-steal with force/no-force. Which choices affect victim selection, and which affect commit writes?
  • Explain why steal/no-force needs both undo and redo recovery.

Source and scope

Naeem Mahoto, Buffer manager, local path 13-BufferManager.pdf, 20 PDF pages. This note paraphrases the source. The page trace and everyday explanations are added study explanations; the original PDF remains local.