Standard buffer managers assume each block is of the same size and costs the same to read. Consider a buffer manager that, instead of LRU, uses the rate of reference to objects, that is, how often an object has been accessed in the last seconds. Suppose we want to store in the buffer objects of varying sizes, and varying read costs (such as web pages, whose read cost depends on the site from which they are fetched). Suggest how a buffer manager may choose which block to evict from the buffer.
Our eviction strategy can use 3 pieces of information:
- Size of a block
- Read Cost of a block
- Rate of Reference of a block
Let’s define the following 3 functions for a block .
-
Let the Size of a given block be denoted as: .
-
Let the Read Cost of a given block be denoted as: .
-
Let the Rate of Reference of a given block be denoted as: .
Define a new function called the Total Cost function for a given block denoted as . Also when defining the function , define it in such a way that it is directly proportional to and .
Then when the buffer manager wants to evict a block, evict the block that has the smallest cost. Let be a block in the buffer such that for all in the buffer. When the buffer manager wants to evict a block, simply evict .