This is another operation system simulation. For the virtual memory management.
PAGE SIZE = 16
MAX SECTORs AVAILABLE = 1000
MAX FRAMEs AVAILABE = 100
(defined in src/java/MemoryUtil.java)
Victim page selection algorithm: Least Frequently Used(LFU)
The program(Located in test/java/ManualTest.java) will:
- Ask user for the page numbers of their single program.
- Ask user for the frame numbers allocated to the program.
- Randomly generate the program counter's number(known as logical address).
- Look page table for the physical address. If not valid(the page not loaded into RAM yet), a page fault occurred, and set the time stamp to 1. If already there, increase the time stamp by 1.
Note that, there are also another JUnit5 tests available in test/java/MemoryUtilTest.java.