A paging and page-replacement lab

The problem

Build a small virtual-memory simulator: translate addresses through a page table, then count the page faults of FIFO, LRU and the clock algorithm on a reference string.

Requirements

Technologies

Step by step

  1. Write the address-translation function with a page size that is a power of 2.
  2. Write one function per replacement algorithm that returns the number of faults.
  3. Run them for 1 to 7 frames on the string 1 2 3 4 1 2 5 1 2 3 4 5 and print a table.
  4. Add the TLB and compute the average access time from the hit rate.
  5. Check your fault counts against the simulator.

Expected result

A program that prints a table of page faults for three algorithms and a range of frame counts, and the average access time with a TLB.

How it is evaluated

Ways to improve it