Due Tuesday, December 10th at 10:00 P.M.
The goals of this project are
- to develop code that simulates several page replacement algorithms and
- to compare the results of different page replacement algorithms.
You may work in groups of two. Collaboration within a group is, of course, unrestricted.
You may discuss the program with members of other groups, but what you turn in must be your own group's
work.
It is a violation to the Honor Code not to acknowledge others' work fully and openly.
You should cite any online resources you consulted to help you solve this project.
You may NOT directly copy any code or any text from anywhere.
Setup
Copy the files in the directory on royal
/Shared/cs322/public/project6
Simulation
Write a program that simulates the following four page replacement algorithms
- OPT (optimal),
- FIFO,
- LRU and
- Second-Chance (aka Clock).
The program can either
- generate a random page reference string and number of page frames, or
- read the page reference string and number of frames from the standard input.
java VMTest -p 6 < 0 1 2 0 1 2 1 ... is one way to specify the input.
The program reports the number of page faults that occur while processing the entire reference string, using pure demand paging.
Analysis
For the following page reference string,
0 1 2 0 1 2 1 2 2 0 3 4 5 4 5 6 5 6 6 5 5 4 4 5 6 5 6 5 7 6 7 7 7 6 6 7 6 7 7 6 5 3 3 4 3 4 3 4 2 3 3 4 3 7 6 6 7
run the 4 algorithms, recording the number of page faults that occur for each of
frames of memory.
Draw graph(s) (using Excel, OpenOffice Spreadsheet...) showing how each algorithm performs with the given reference string.
- The x-axis of your graph should be the number of page frames.
- The y-axis should be the number of page faults.
If possible, graph all 4 algorithms in the same chart.
Discuss the results of this experiment in your readme. In particular, answer, with reasons, the following questions.
- Which of FIFO, LRU or Second-Chance performs closest to OPT?
- How does the experiment vary depending on the number of frames available?
- Is there a number of frames at which adding more frames provides little improvement in how well an algorithm performs?
- Is it reasonable to generalize from one example?
- What additional questions would you answer in doing a more thorough analysis of these algorithms?
Submit
Please submit a directory named by your two first names by the deadline on royal
/Shared/cs322/submit/proj6
It must contain
- your classes such as Opt.java, Fifo.java, Lru.java,
SecondChance.java and VMTest.java,
- your graph(s) and
- your readme with
- your names at the top,
- instructions for compiling and running your code,
- your responses to the analysis, and
- known issues if there are any problems with your simulation.
Grading
This project is graded out of 20 points.