A computer has 16 pages of virtual address space but the size of main memory…

2014

A computer has 16 pages of virtual address space but the size of main memory is only four frames. Initially the memory is empty. A program references the virtual pages in the order 0, 2, 4, 5, 2, 4, 3, 11, 2, 10. How many page faults occur if LRU page replacement algorithm is used?

  1. A.

    3

  2. B.

    5

  3. C.

    7

  4. D.

    8

Attempted by 77 students.

Show answer & explanation

Correct answer: C

We simulate LRU with 4 frames on reference string: 0, 2, 4, 5, 2, 4, 3, 11, 2, 10. 1. 0: Fault (Mem: [0]) 2. 2: Fault (Mem: [0, 2]) 3. 4: Fault (Mem: [0, 2, 4]) 4. 5: Fault (Mem: [0, 2, 4, 5]) 5. 2: Hit (LRU: 0) 6. 4: Hit (LRU: 2) 7. 3: Fault (Replace 0) -> Mem: [5, 2, 4, 3] 8. 11: Fault (Replace 5) -> Mem: [2, 4, 3, 11] 9. 2: Hit (LRU: 4) 10. 10: Fault (Replace 4) -> Mem: [3, 11, 2, 10] Total faults: 7.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro