Consider a demand paging system with three frames, and the following page reference string: 1 2 3 4 5 4 1 6 4 5 1 3 2 . The contents of the frames are as follows initially and after each reference (from left to right):
The *-marked references cause page replacements.
Which one or more of the following could be the page replacement policy/policies in use?
View worked solution
Answer: D
To determine which page replacement policy is used, we analyze the page replacement decisions at key steps:
- Least Recently Used (LRU):
At step 4 (reference to page 4), the frames contain
[1, 2, 3]. The least recently used page is 1. However, page 2 is replaced instead. Thus, LRU is not used. - Least Frequently Used (LFU):
At step 8 (reference to page 6), the frames contain
[1, 4, 5]. The frequencies of the pages in memory are:- Page 1: 2 times (at steps 1 and 7)
- Page 4: 2 times (at steps 4 and 6)
- Page 5: 1 time (at step 5)
- Most Frequently Used (MFU):
At step 12 (reference to page 3), the frames contain
[6, 1, 5]. The frequencies of the pages in memory are:- Page 6: 1 time (at step 8)
- Page 1: 3 times (at steps 1, 7, and 11)
- Page 5: 2 times (at steps 5 and 10)
- Optimal Page Replacement:
Let's check the decisions under Optimal policy:
- At step 4 (reference to 4): Frames are
[1, 2, 3]. Future references are 1 (step 7), 3 (step 12), and 2 (step 13). Page 2 is referenced furthest in the future, so it is replaced. (Matches trace) - At step 5 (reference to 5): Frames are
[1, 4, 3]. Future references are 4 (step 6), 1 (step 7), and 3 (step 12). Page 3 is referenced furthest in the future, so it is replaced. (Matches trace) - At step 8 (reference to 6): Frames are
[1, 4, 5]. Future references are 4 (step 9), 5 (step 10), and 1 (step 11). Page 1 is referenced furthest, so it is replaced. (Matches trace)
- At step 4 (reference to 4): Frames are
Free practice · Your answers on this page are not saved.
