1 / 8

HW4: Buffer Manager

HW4: Buffer Manager . Instructors: Winston Hsu, Hao-Hua Chu Fall 2009. Architecture of a DBMS. Query. Query Optimization and Execution. Relation Operators. File and Access Methods. Buffer Management. Disk Space Management. DB. Buffer Manager. Simple Buffer Manager Structure

brooke
Download Presentation

HW4: Buffer Manager

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. HW4: Buffer Manager Instructors: Winston Hsu, Hao-Hua Chu Fall 2009

  2. Architecture of a DBMS Query Query Optimization and Execution Relation Operators File and Access Methods Buffer Management Disk Space Management DB

  3. Buffer Manager • Simple Buffer Manager Structure • Pages in the buffer pool is not ordered in any way • Hash table to figure out what frame a given disk page occupies • Love/Hate buffer replace algorithm • Operations • bring a disk page into the buffer pool and pin it • unpin a page in the buffer pool • allocate/de-allocate pages on disk • flush/flush all buffer page(s) into the disk page

  4. Buffer Manager Memory Structure Buffer Page Description FrameDesc pageNodirtyFlagpin_count numbuf Buffer Pool Page Buffer Hash Table pageNo frameNo *next …… HTSIZE ……

  5. Love/Hate Replacement • upper level user hints the buffer manager that the page is loved or hated. • Replace hated pages first, then loved pages. • MRU list for the hated pages, LRU list for the loved pages • “ Love conquers hate “

  6. Functions (in buf.h and buf.C) • BufMgr • Initializes buffer manager: create buffer pool, buffer pool description, hash table….etc. • Malloc, calloc….. • pinPage, unpinPage, newPage, freePage, flushPage, flushAllPages • Use Minibase API • Your own functions (if needed) • For hash table and replacement policy

  7. Minibase APIs • Page • Status MINIBASE_DB->read_page(PageIdpageno, Page* pageptr) • Status MINIBASE_DB->write_page(PageIdpageno, Page* pageptr) • Status MINIBASE_DB->allocate_page(PageId& start_page_num, intrun_size=1) • Status MINIBASE_DB->deallocate_page(PageIdstart_page_num, intrun_size=1) • Errors handling status = MINIBASE_DB->write_page(pageid, &bufPool[i]); if (status != OK) { // status: OK or FAIL // your own error message }

  8. Get Started • Read the PDF for detail description. • Group assignment (at most 2 people/group) • Download BufMgr for source code. • Read README.first before you strat. • Post your questions on ptt.cc/ CSIE_DBMS. • Minibase homepage and Google

More Related