CS357: Database Systems Implementation
Solution to Homework Assignment 3
I modified BasicBufferMgr so that it no longer uses an array of
buffers. Instead, there are two collections: a queue of unpinned
buffers, and a map of allocated buffers. Every buffer will be in
at least one of these collections, and possibly both. The class BasicBufferMgr underwent the most change. Class Buffer changed only in that I added a new constructor and a method toString.
For my test program, I wrote private methods pinBuffer(int i) and unpinBuffer(int i), so I could just think in terms of pinning and unpinning blocks. I used a map to hold the block-buffer correspondence.
Click on the links to see my solution for each of the following classes: Buffer, BasicBufferMgr, Hw3BufferTestSols.