Suppose that the virtual Address space has eight pages and physical memory…
2016
Suppose that the virtual Address space has eight pages and physical memory with four page frames. If LRU page replacement algorithm is used, _____ number of page faults occur with the reference string.
0 2 1 3 5 4 6 3 7 4 7 3 3 5 5 3 1 1 1 7 2 3 4 1
- A.
13
- B.
12
- C.
10
- D.
9
Attempted by 98 students.
Show answer & explanation
Correct answer: A
Answer: 13 page faults.
Explanation: Simulate the Least Recently Used (LRU) page replacement with four physical frames, starting with empty frames. For each reference, note whether it causes a page fault and the resulting frame contents (ordered from least recently used to most recently used).
Reference 0 — fault. Frames: [0]
Reference 2 — fault. Frames: [0, 2]
Reference 1 — fault. Frames: [0, 2, 1]
Reference 3 — fault. Frames: [0, 2, 1, 3]
Reference 5 — fault (evict 0). Frames: [2, 1, 3, 5]
Reference 4 — fault (evict 2). Frames: [1, 3, 5, 4]
Reference 6 — fault (evict 1). Frames: [3, 5, 4, 6]
Reference 3 — hit. Frames recency updated: [5, 4, 6, 3]
Reference 7 — fault (evict 5). Frames: [4, 6, 3, 7]
Reference 4 — hit. Frames recency: [6, 3, 7, 4]
Reference 7 — hit. Frames recency: [6, 3, 4, 7]
Reference 3 — hit. Frames recency: [6, 4, 7, 3]
Reference 3 — hit. Frames remain: [6, 4, 7, 3]
Reference 5 — fault (evict 6). Frames: [4, 7, 3, 5]
Reference 5 — hit. Frames: [4, 7, 3, 5]
Reference 3 — hit. Frames recency: [4, 7, 5, 3]
Reference 1 — fault (evict 4). Frames: [7, 5, 3, 1]
Reference 1 — hit. Frames: [7, 5, 3, 1]
Reference 1 — hit. Frames: [7, 5, 3, 1]
Reference 7 — hit. Frames recency: [5, 3, 1, 7]
Reference 2 — fault (evict 5). Frames: [3, 1, 7, 2]
Reference 3 — hit. Frames recency: [1, 7, 2, 3]
Reference 4 — fault (evict 1). Frames: [7, 2, 3, 4]
Reference 1 — fault (evict 7). Frames: [2, 3, 4, 1]
Total page faults = 13
A video solution is available for this question — log in and enroll to watch it.