This
component of a
DBMS provides a layer of
indirection between the
pages of the
database on
disk, and the physical
RAM available to the upper layers of the system. The
buffer manager oversees a "buffer pool," which is usually represented as an array of "Page"
objects the size of a single
disk block. It works very much like a
virtual memory manager for an
operating system, but with some major differences. The usual set of operations supported by the buffer manager includes:
Pin Page. This function loads the page into the buffer if not already there, "pins" it (increments the "pin count" so that it cannot be swapped out of the pool), and returns a pointer to the page to the calling code.
Unpin Page. This decrements the "pin count" of the page. If the pin count is zero, the page is a candidate for replacement.
New Page. Calls the database on disk to create a new page, or run of pages on disk, loads the first into the buffer, and pins it.
Free Page. Calls the database on disk to deallocate the page from disk.
Flush Page. Checks to see if the page is dirty. If so, writes the page to disk ("cleans" it).
The Pages are identified by "page number" which correspond to the number of the physical disk block. The buffer manager is a crucial low-level component of all DBMSes, and understanding it is an important step to understanding the modern database system.