G sequen6al scans pages can be prefetched several

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 6me B r Man anagement n a D MS Buffeuffer Magement in ia DBBMS Page Requests from Highe r Leve ls BUFFER POO L disk page free frame MAIN MEMORY DISK DB choice of frame dictated by replacement policy Data must be in RAM for DBMS to operate on it! •  Data must be in RAM for DBMS to operate on it! Table of <frame# , pageid> pairs is maintained. •  DaTable naf meframeNo, pRageNo> apdairs riks maintained tabase Ma oge < nt Systems 3ed , R. amakrishnan n J. Geh e 12 When a Page is Requested… •  If requested page is not in pool: –  Choose a frame for replacement –  If frame is dirty, write it to disk (“write on replacement”) –  Read requested page into chosen frame •  Pin the page and return its address •  If requests can be predicted (e.g., sequen6al scans), pages can be pre ­fetched several pages at a 6me –  Again, opportunity ignored in DavisDB for simplicity More on Buffer Management •  Requestor of page must unpin it, and indicate whether page has been modified –  Dirty bit is used for this •  Page in pool may be requested many 6mes –  A pin count (aka reference count) is used. A page is a candidate for replacement iff its pin count = 0 •  Concurrency control and recovery may entail addi6onal I/O when a frame is chosen for replacement. (Write ­Ahead Log protocol; more later…) –  No concurrency control or recovery in DavisDB Buffer Replacement Policy •  Frame is chosen for replacement by a replacement policy: –  Least ­recently ­used (LRU), Clock, MRU, etc –  DavisDB uses LRU •  Policy can have big impact on # of I/O's; depends on the access paDern •  Sequen3al flooding: nasty situa6on caused by LRU + repeated page scans –  # buffer frames < # pages in file means each page request causes an I/O. MRU much be\er in this situa6on (but not in all situa6ons, of course). DBMS vs. OS File System •  OS does disk space and buffer management; why not let the OS manage these tasks? •  Differences in OS support: portability issues •  Some technical limita6ons, e.g., files can...
View Full Document

This document was uploaded on 03/12/2014 for the course CSCI 165B at UC Davis.

Ask a homework question - tutors are online