Operating systems
Week 9
Lab Task
Virtual Memory
Task: Page Replacement Algorithms Implementation
Implementing three important page replacement algorithms in Java: Optimal,
LRU (Least Recently Used), and FIFO (First-In-First-Out). These algorithms
play a crucial role in managing memory efficiently in operating systems.
Task Description:
Your task involves the following steps:
1. Implement Optimal, LRU, and FIFO algorithms separately in Java.
2. The algorithms will take a sequence of page references as input.
3. Develop a test program to compare the performance of the three algorithms using the
same input sequence and memory capacity.
4. Analyze and compare the number of page faults generated by each algorithm.
5. Ensure that your code includes comments to explain the logic and algorithms used.
6. Experiment with different input sequences and memory capacities to understand how
the algorithms behave.
Expected Output:
Upon completion of this lab task, you should:
1. Have implemented the Optimal, LRU, and FIFO page replacement algorithms in Java.
2. Conducted tests with various input sequences and memory capacities.
3. Analyzed and compared the performance of each algorithm based on the number of
page faults and hit.
4. Also, calculate their percentage as discussed in the lecture class
Submission Guidelines:
1. Submit your Java source code for each algorithm implementation and include a brief
report summarizing your observations and insights from comparing the algorithms.
2. Deadline: submit your completed lab task by the specified deadline during the lab hours.
Sample Inputs to check:
String 1 = 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5; Frames = 4
String 2 = 5, 4, 3, 2, 1, 5, 4, 3, 2, 1; Frames = 3
String 3 = 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2; Frames = 4