Read first the whole assignment carefully before you start implementing and before you start creating projects and workspaces. There are links to more instructions at the end of this text.
In this assignment you will implement a buffer manager. The buffer manager is responsible for bringing pages from the disk to the main memory as needed. The buffer manager:
In addition, you will be required to run experiments studying the effect the size of the buffer pool has on performance and present your results.
You will be provided with code that implements a database class (DB) and a page class (Page). The definition of public interface for the buffer manager class (BufMgr) is available, but is not implemented. You can find out more about the implemented classes and types here :
Also, you'll be given a visualization tool, BufferSim, which simulates buffer manager operations.
The source code for the project can be downloaded from the course management system. If you unzip this file, you will have four directories.
Directory "bufmgr"
Directories "src" and "inc":
Directory "example"
You are required to modify and fill in the gaps in bufmgr.cpp and bufmgr.h, specifically :
Here are the instructions on how to set the replacement policy.
1) Number of PinPage requests made.
2) Number of PinPage requests that result in a miss (i.e. the page is not in the buffer when the pin request is made)
3) Number of "dirty" pages written to disk.
4) Total time taken to run the test. (This will be collected for you by the code that already exists in main.cpp)
For each of the replacement policy you implemented (MRU and Clock), you need to do the following:
1)
After your tests have run successfully, you will need to run five experiments while varying the buffer size, and describe the
effects a larger buffer pool has on the statistics (including
time) that you have collected. You should also explain these
variations.
2) Running the
experiments is basically running the tests provided for you again
with different buffer sizes. At this point you should also look
at the test procedures and see why the buffer size increases will
affect the performance. (note: we are only interested in
statistics relating to the fourth and fifth tests.)
3) In order to change
the buffer size go to the file minirel.h and change the value of
the constant NUMBUF. The buffer sizes recommended are
50,100,150,200, and 250. (Note: Do not submit minirel.h with your assignment; we
will use our own version of minirel.h and change NUMBUF to test your program.)
4) Remember to close
all major applications on your computer before running the tests,
since they will affect the time it takes to run the tests.
In addition, you should then contrast the performance of the
buffer manager when using the replacement policies that you have implemented.
Remember that if you define the replacement policy as a base
class with virtual functions then all you have to do is derive
the MRU and Clock classes and implement the functions.
Important note 1: Your assignment should compile and run on Visual Studio .Net on Windows XP machines (such as available in the CSUGLAB). If you like, you can do your implementation at home on personal machines. However, it is your responsibility to get the code to work on the departmental machines before you submit it (since the TAs will test the code in the departmental machines).
Important note 2: You should not modify any of the files provided to you other than BufMgr.h and BufMgr.cpp. The TAs will not use your modified files.
You need to follow certain coding convention for all your assignments.
Your programs will be graded based on the following criteria.
Correctness (65%)
You will get full marks if your implementation is correct. Partial credit will be given to a partially correct submission.
Coding Style (15%)
We expect you to write neat code. Code should be nicely indented and commented. We also expect you to follow the coding conventions.Statistical Analysis (10%)
You should clearly describe what effects a larger buffer pool has on performance and why. You should use the statistics you collect to support your reasoning.
Documentation (10%)
You should also submit the online copy of your documentation using any format you like. (MS Word, HTML etc.), explaining the code that you have written. This should include assumptions that you made, description of any new class that you have added, and any other special feature we should take note of. As a guideline, the document should be 2-3 pages long (with normal fonts and spacing), or more if you feel necessary.
This project can be done in teams of two. Both team members will receive the same grade.
IMPORTANT: Collaboration across teams is not allowed, beyond discussing broad logical ideas (e.g. how does the clock algorithm work?) and C++ doubts (e.g.. how does one initialize static variables?). Looking at the code from another team is also not allowed. In any situation where a team feels that it may have compromised one of these guidelines or if you think that another team violates these guidelines, talk immediately to the instructor.