Database Management Systems
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
CSCI 5708: Architecture and Implementation of Database Management Systems
Lab 1
Lab can be done individually or in a group of two.
A. Introduction
In this lab you are going to change the buffer replacement policy that is currently used in
PostgreSQL, a major open source DBMS. In particular, the original replacement policy of
PostgreSQL is a clocksweep algorithm with LRU (Least Recently Used). In this lab, you are asked
to implement a custom policy to replace the FIFO, LRU and MRU page based on their turn,
starting with FIFO. You are asked to do this without the clocksweep algorithm. To verify this, you
will print some information from the selected buffer and the page it contains.
B. Hybrid Replacement Policy
This is a custom replacement policy that alternates between the First In First Out (FIFO), Least
Recently Used (LRU) and the Most Recently Used (MRU). The first time it picks a victim it's the
FIFO page, the second time it’s LRU page, the third time it's the MRU page then the fourth time
it's the FIFO page again and so on.
For example, assume you have 3 pages in your buffer with size 3 which were accessed in the
following sequence: P1, P3, P2, P3, P1.
The buffer now contains P1, P3, P2.
The following sequence is the next pages to be accessed in order: P4, P5, P6, P7.
For P4, the FIFO P1 will be chosen as the victim and the buffer becomes P4, P3, P2.
For P5, the LRU P2 will be chosen as the victim and the buffer becomes P4, P3, P5.
For P6, the MRU P5 will be chosen as the victim and the buffer becomes P4, P3, P6.
For P7, the FIFO P3 will be chosen as the victim and the buffer becomes P4, P7, P6.
Therefore, the hybrid policy alternates between FIFO, LRU and MRU, starting with FIFO.
The same logic applies if you have any number of pages. You will need to implement this
algorithm and make sure it adapts with the database buffer management policy concepts, such
as pin count.