CS346 - Spring 2011
Database System Implementation
One way to win the RedBase
I/O Efficiency Contest without increasing the size of the PF
buffer pool is to allocate a separate chunk of memory that's used for
your own separately-managed large buffer pool (for pages, records,
whatever). Obviously doing so is not allowed as far as the contest is
concerned. For the contest, if you wish to store data from the
database in allocated memory you have two options:
- You are permitted to allocate small amounts of memory, e.g., to
store a fixed amount of header information or a couple of records at
a time.
- If you want to allocate memory for full pages of records or
other data, e.g., to implement a nested-block or RID-based join, you
can use the "scratch pages" feature in the PF
Component (see the PF specification for details). Every time you
need a page worth of scratch memory, call
PF_Manager::AllocateBlock, which allocates a pinned page of
memory in the buffer pool and returns a pointer to it. When you are
done using the scratch memory, call PF_Manager::DisposeBlock
on this pointer to release the buffer page.
You are welcome to implement data caching mechanisms that do not use
the buffer, either now or in your extension, but please disable such
mechanisms when you turn in your basic project if you want to enter
the contest.
Feel free to contact the instructor or TA if you have specific
questions about this policy as it relates to your own implementation.