Introduction
Buffer management is responsible for managing pages in memory and process requests from the file and index manager.
Given the limited memory space available, it’s imperative that we cannot retain all pagespages]] are evicted or new ones are loaded into memory, the buffer manager interacts with the disk space manager to execute the necessary disk operations.
Buffer Pool
- Memory is partitioned into frames so that buffer pool is built.
- A buffer frame can hold exactly one Page.
Metadata Table
- Buffer Pool has additional space for a metadata table
- Frame ID: uniquely associated with a memory address
- Page ID: which Page a frame currently contains
- Dirty Bit: whether or not a Page has been modified
- Pin Count: number of requestors currently using this Page
Handle Page Requests
Basically same as OS memory management.
Replacement Policy
- LRU Replacement: evict the least recently used unpinned page
- need a last used column in the metadata table. update the column with time at which pin count is decremented.
- performance suffers when pages are accessed repeatedly, where buffer pool size
- Clock Replacement: treats the metadata table as a circular list of frames.
- MRU Replacement: evict the most recently used unpinned page, contrasting with LRU
- great when > buffer pool size (as opposed to LRU senario mentioned above)