Consider a virtual page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3,…
2017
Consider a virtual page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 Suppose a demand paged virtual memory system running on a computer system such that the main memory has 3 page frames. Then __________ page replacement algorithm has minimum number of page faults.
- A.
FIFO
- B.
LIFO
- C.
LRU
- D.
Optimal
Attempted by 30 students.
Show answer & explanation
Correct answer: D
Answer: The optimal page replacement algorithm has the minimum number of page faults (9) for the given reference string with 3 frames.
Explanation and summary of page-fault counts for common algorithms:
FIFO: 15 page faults. FIFO evicts the oldest loaded page, which can remove a page that will be needed soon in this reference sequence.
LIFO: 12 page faults. LIFO evicts the most recently loaded page; this often discards a page that could be reused shortly, increasing faults.
LRU: 12 page faults. LRU evicts the least recently used page based on past history; it performs better than FIFO on many workloads but still yields more faults than the optimal method here.
Optimal: 9 page faults. Optimal evicts the page whose next use is farthest in the future (or not used again). For example, early in the sequence it replaces page 7 when a new page 2 arrives because 7's next use is much later, and later it replaces page 4 which is not used again—decisions that minimize total faults.
Conclusion: Because the optimal algorithm makes replacement choices based on future knowledge, it yields the minimum possible page faults (9) for this reference string and hence is the correct choice.
A video solution is available for this question — log in and enroll to watch it.