Consider the memory reference string given below for a memory with 3 frames…
2022
Consider the memory reference string given below for a memory with 3 frames per process: Reference string : 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5 The number of page faults for FIFO page replacement policy is:
Answer: D. nine — FIFO (First-In-First-Out) page replacement keeps the resident pages in a queue ordered strictly by arrival time. Every reference to a page not currently…
- A.
eleven
- B.
ten
- C.
twelve
- D.
nine
Attempted by 476 students.
Show answer & explanation
Correct answer: D
FIFO (First-In-First-Out) page replacement keeps the resident pages in a queue ordered strictly by arrival time. Every reference to a page not currently resident is a fault; when the frames are full, that fault evicts the page that has been resident the longest, regardless of how recently it was used, and a hit never changes the queue order.
Reference 1: not resident, frames are not full yet -> load 1 -> queue (oldest to newest): [1] -> fault.
Reference 2: not resident -> load 2 -> queue: [1, 2] -> fault.
Reference 3: not resident -> load 3 -> queue: [1, 2, 3] -> fault.
Reference 4: not resident, frames full -> evict the oldest page, 1 -> queue: [2, 3, 4] -> fault.
Reference 1: not resident -> evict the oldest page, 2 -> queue: [3, 4, 1] -> fault.
Reference 2: not resident -> evict the oldest page, 3 -> queue: [4, 1, 2] -> fault.
Reference 5: not resident -> evict the oldest page, 4 -> queue: [1, 2, 5] -> fault.
Reference 1: already resident -> queue unchanged: [1, 2, 5] -> hit.
Reference 2: already resident -> queue unchanged: [1, 2, 5] -> hit.
Reference 3: not resident -> evict the oldest page, 1 -> queue: [2, 5, 3] -> fault.
Reference 4: not resident -> evict the oldest page, 2 -> queue: [5, 3, 4] -> fault.
Reference 5: already resident -> queue unchanged: [5, 3, 4] -> hit.
Cross-check by counting hits instead of faults: only three of the twelve references land on an already-resident page - the repeated references to 1 and 2 once 5 has replaced 4, and the final reference to 5 - so the remaining nine references are faults, matching the step-by-step trace above.
FIFO page replacement with 3 frames therefore produces nine page faults for this reference string.