Consider a main memory with the capacity of 3 page frames which are initially…
2021
Consider a main memory with the capacity of 3 page frames which are initially empty. Page reference is: 4, 7, 6, 1, 7, 6, 1, 2, 7, 2. What is the number of page faults using the optimal page replacement algorithm?
Answer: C. 5 — Given: Frames: 3 (initially empty) Reference String: 4, 7, 6, 1, 7, 6, 1, 2, 7, 2 Request Frames (State After Request) Fault? Reason for Replacement 4 [4, -,…
- A.
7
- B.
6
- C.
5
- D.
4
Attempted by 360 students.
Show answer & explanation
Correct answer: C
Given:
Frames: 3 (initially empty)
Reference String: 4, 7, 6, 1, 7, 6, 1, 2, 7, 2
Request | Frames (State After Request) | Fault? | Reason for Replacement |
4 | [4, -, -] | Yes | Initial load. |
7 | [4, 7, -] | Yes | Initial load. |
6 | [4, 7, 6] | Yes | Initial load. |
1 | [1, 7, 6] | Yes | 4 is replaced because it is never used again. |
7 | [1, 7, 6] | No | 7 is already in memory. |
6 | [1, 7, 6] | No | 6 is already in memory. |
1 | [1, 7, 6] | No | 1 is already in memory. |
2 | [1, 7, 2] | Yes | 6 is replaced because 1 and 7 are used sooner. |
7 | [1, 7, 2] | No | 7 is already in memory. |
2 | [1, 7, 2] | No | 2 is already in memory. |
Total Page Faults: 5
Total Page Hits: 5
A video solution is available for this question — log in and enroll to watch it.