Page replacement algorithms to analyse page fault and belady's anomaly and thrashing.
- Least Recently Used (LRU)
- Most Recently Used (MRU)
- The reference string is randomly generated using a seed value. This seed value is generated using the current time. So, the reference string will be different every time the program is run.
- The user can provide 3 values as command line arguments. These values are:
- Maximum frame size
- Maximum page array size (the maximum number of pages in the reference string)
- Flag
- sf: Fixed reference string for each call as the frame size increments.
- sr: Random reference string for each call as the frame size increments.
- Clone the repository
- Run the following commands in the terminal to compile the code:
g++ mru.cpp pbPlots.cpp supportLib.cpp -lm -o mru g++ lru.cpp pbPlots.cpp supportLib.cpp -lm -o lru
- Run the following commands in the terminal to generate plots:
Replace the placeholders with the desired values. 1
./mru <maxFrameSize> <maxPageArraySize> -<flag> ./lru <maxFrameSize> <maxPageArraySize> -<flag>
This program will generate plots for the algorithms in "./plots/" folder.
Naming convention for the plots is as follows: "<Algorithm Name>-<flag>-<maxFrameSize>-<maxPageArraySize>"
Footnotes
-
Note: All three command line args must be provided. ↩