Project V FAQ
Running the Grading Scripts (note, we have not tested THESE instructions, our
scripts worked when running from our grading directories, etc... you may need to
fix paths, etc.)
- To run the basic tests using the revised harness...
a) copy the files in ~cs186/buftest/grading/tester to ~/postgresql-7.2.2/src/tester
b) inside ~/postgresql-7.2.2/src/tester, run make
c) run "grade-mru filename" where detailed output goes to
filename, if you compiled with MRU files
d) run "grade-s2q filename" where detailed output goes to
filename, if you compiled with S2Q files
- To run the real tests using the PostgreSQL backend...
a) copy ~cs186/buftest/grading/real/pg_config.h.in to ~/postgresql-7.2.2/src/include.
This file changes the block size to 512 blocks to induce more page faults.
b) copy ~cs186/buftest/grading/real/config.cache to ~/postgresql-7.2.2
c) run ./configure --prefix=/home/cc/cs186/fa02/class/cs186-XX/postgresql-7.2.2/exe
(be sure to change path appropriately)
d) run gmake clean
e) gmake
f) gmake install
h) copy ~cs186/buftest/grading/real/* to some directory
i) delete $PGDATA directory
i) run ./runQuery from that directory, it will initdb, create a test
database called test, load two tables R and S, and then run two queries, one
which puts the results in another table (causing writes) and finally an
aggregation over the results. If the count = 917 for the second query, you
got full credit.
FAQ
- You may find it easier to understand the 2Q psuedocode (in the context of pinning and unpinning pages) if you replace 2 words
if p is on the Am queue
then
put p on the front of the Am queue
else if p is on the A1 queue
then
...
could be read:
if p WAS on the Am queue
then
put p on the front of the Am queue
else if p WAS on the A1 queue
then
...
- Some definitions
- A Free Page is a page with no data, it is available for replacement.
- A Pinned Page contains data, is in use, and is not available for replacment (thus it is not on any replacement queues -- if you implement things the way PostgreSQL has, you may choose to do this differently of course)
- A UnPinned Page is not in use (if it does not contain data it is also free) and is eligible for replacement (thus it should be on some replacement queue). If it contains data, PostgreSQL may choose to re-pin the page and re-use the data that is in memory at a later time..
- Shared Memory - PostgreSQL stores all the buffers in shared memory so that multiple backends can share the buffers. For this project, your data structures do not need to be in shared memory (so you may use malloc), although if something is already allocated in shared memory, leave it there.
- If 2Q tells you to take a page from an empty queue, do the smart thing and take a page from some queue that has pages. Only return NULL if there is no other option.