172k views
2 votes
Consider the following page reference string :

1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
ii) For LRU page replacement algorithm with 5 frames, the number of page faults is :
a) 10
b) 14
c) 8
d) 11

1 Answer

4 votes

Final answer:

a) 10.The number of page faults for the given page reference string using the LRU algorithm with 5 frames is 10.

Step-by-step explanation:

The LRU (Least Recently Used) page replacement algorithm is used to replace the page that has not been used for the longest period of time. In this case, we have a page reference string and we need to determine the number of page faults when using the LRU algorithm with 5 frames.

Let's go step by step:

  1. Initially, the frames are empty.
  2. When the first page '1' is referenced, we have a page fault since the frame is empty.
  3. The second page '2' is also a page fault since the frame is still empty.
  4. The third page '3' is a page fault since the frame is still empty.
  5. When the fourth page '4' is referenced, it is a page fault since the frame is still empty.
  6. When the fifth page '2' is referenced, it is a page fault since the frame does not contain '2'.
  7. When the sixth page '1' is referenced, it is a page fault since the frame does not contain '1'.
  8. The seventh page '5' is a page fault since the frame does not contain '5'.
  9. The eighth page '6' is a page fault since the frame does not contain '6'.
  10. When the ninth page '2' is referenced, it is a page fault since the frame does not contain '2'.

Therefore, the number of page faults for the given page reference string using the LRU algorithm with 5 frames is 10.

User Benoir
by
8.8k points