Consider a hypothetical machine with 3 pages of physical memory, 5 pages of…
2020
Consider a hypothetical machine with 3 pages of physical memory, 5 pages of virtual memory, and <𝐴,𝐵,𝐶,𝐷,𝐴,𝐵,𝐸,𝐴,𝐵,𝐶,𝐷,𝐸,𝐵,𝐴,𝐵> as the stream of page reference by an application. If 𝑃 and 𝑄 are the number of page faults that the application would incur with FIFO and LRU page replacement algorithms respectively, then (𝑃,𝑄)= _______(Assuming enough space for storing 3 page frames)
- A.
(11,10)
- B.
(12,11)
- C.
(10,11)
- D.
(11,12)
Attempted by 24 students.
Show answer & explanation
Correct answer: B
Answer: (11,12) — FIFO faults = 11; LRU faults = 12.
Approach: Simulate both page-replacement algorithms with 3 frames starting from empty frames and count page faults.
FIFO (First-In-First-Out):
Faults occur at references: 1(A), 2(B), 3(C), 4(D), 5(A), 6(B), 7(E), 10(C), 11(D), 13(B), 14(A). Total = 11 faults.
LRU (Least Recently Used):
Faults occur at references: 1(A), 2(B), 3(C), 4(D), 5(A), 6(B), 7(E), 10(C), 11(D), 12(E), 13(B), 14(A). Total = 12 faults.
Therefore the ordered pair (P,Q) = (11,12), where P is FIFO faults and Q is LRU faults.
A video solution is available for this question — log in and enroll to watch it.