Csucdavisedugreencoursesecs165bpagefilehtml see also

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: File and Buffer Management in DavisDB User commands results Command Parser (given) es ueri q Query Engine (4) get metadata index scans System Manager (3) read/write/scan records Indexing (2) indic es create files, read/ write pages Page File Manager (given) OS File System Record Manager (1) data, metadata Buffer Manager (given) + User Extension (5) Paged File Component (Provided) •  Paged File Component has two func6ons: –  provides in ­memory buffer pool of pages/frames –  performs low ­level file I/O at the granularity of pages •  Overview on class web site: h[p://www.cs.ucdavis.edu/~green/courses/ecs165b/pageFile.html See also Doxygen docs: h[p://www.cs.ucdavis.edu/~green/courses/ecs165b/docs/index.html •  Where it all begins: PageFileManager… PageFileManager •  Your code will use one singleton instance of this class •  Manages the buffer pool of in ­memory pages –  allocate/de ­allocate "scratch" pages –  coordinates with file handle objects to bring pages to/from disk –  uses LRU replacement policy •  Used to create/open/close/remove page files –  Returns PageFileHandle object to manage pages within a file PageFileHandle •  Returned by PageFileManager, used to: –  allocate/de ­allocate pages in the file –  pages iden6fied by logical page number rather than physical offset –  mark page as dirty –  force page to disk –  scan pages in file Coding Tip: Don't Forget to Free Memory! •  DBMS is a long ­running process; memory leaks are unacceptable •  Every new must have a matching delete •  With some coding discipline, can avoid many problems –  When possible, put new and delete close together in the code, so that a human can easily verify correctness –  Memory must always be freed, even when handl...
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