• edited by
8,237 views
26 26 votes

​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):
$$  \begin{array}{|c|lllllllllllll|} \hline \text{initially} & \text{after} \\ \hline 
 -&1^* &2^* & 3^* & 4^* & 5^* & 4  & 1  & 6^* & 4  & 5  & 1^* & 3^* & 2^*  \\ \hline
-&1   & 1   & 1   & 1   & 1   & 1  & 1  & 6   & 6  & 6  & 6   & 6   & 2  \\  \hline
-&-   & 2   & 2   & 4   & 4   & 4  & 4  & 4   & 4  & 4  & 1   & 1   & 1  \\  \hline -&-   & -   & 3   & 3   & 5   & 5  & 5  & 5   & 5  & 5  & 5   & 3   & 3 \\\hline
\end{array}$$
The *-marked references cause page replacements.

Which one or more of the following could be the page replacement policy/policies in use?

  1. Least Recently Used page replacement policy
  2. Least Frequently Used page replacement policy
  3. Most Frequently Used page replacement policy
  4. Optimal page replacement policy

4 Answers

16 16 votes
1234541645132
1111111666662
-224444444111
--33555555533


1) Here LRU fails because 1 is least recently used not 2.
2) Here LFU fails because least used until that point is 5 not 1.
3) Here MFU fails because most used until that point is 1 not 5.
Only Optimal Page Replacement algorithm is correct.

12 12 votes

Here request refers to the requested page from the reference string Frame0,Frame1,Frame2 are the contents of 3 frames and * denotes the page fault in :

You can clearly see that none of the LRU,MRU,LFU matches the above contents of the frames and Optimal page replacement alogorithm can only obtain the above result

So,Option D is correct answer

• edited by
11 11 votes
option A) LRU - at Reference 4, LRU would replace Page 1 (oldest), but the given data replaces Page 2. so not LRU.

option B) LFU -  LFU is one such page replacement policy in which the least frequently used pages are replaced. If the frequency of pages is the same, then the page that has arrived first is replaced first. Now at reference 4 ie when 4 comes  1 2 3 all of them has a frequency of 1 but as 1 has arrived 1st it should get replaced but instead 2 gets replaced .hence it is not LFU

option c) MFU - MFU Algorithm is a Page Replacement Algorithm in the Operating System that replaces the page accessed a maximum number of times in the past. If more than one page is accessed the same number of times, then the page which occupied the frame first will be replaced ie that arrived 1st should get replaced. Again at reference 4 ie when 4 comes ...1 2 3 all has the same frequency (1 for all) but as 1 arrived 1st it should get replaced but instead 2 got replaced hence it is not MFU

option D) optimal - at reference 4 when 4 comes it sees that out of 1 2 and 3 .. 2 will be used last therefore it replaces with 2 ..at reference 5 ie when 5 comes it sees that out of 1 4 3 .3 will be used last so 3 got replaced and so on ..u can verify it follows optimal page replacement algo

Therefore answer is option D) Optimal page replacement policy

 
2 2 votes
At Reference 4, LRU would replace Page 1 (oldest), but the given data replaces Page 2. so not LRU.

At Reference 11(page 1),page frequencies are 1:2 ,2:1 ,3:1 ,4:3 ,5:2. and 1 is replacing 4 which is most frequently used, hence its not LFU.

At Reference 8(page 6),page frequencies are 1:2 ,2:1 ,3:1 ,4:2 ,5:1. but 6 replacing 1 which is MFU , it should have replaced 2 or 3, so not MFU.

It is Optimal page replacement policy because when it is replacing 4 at page reference 4, it is seeing in future that 2 is used at last.

Then again when it is replacing 3 with 5 at page reference 5, it is seeing that 3 is needed after 1. and so on you can keep verifying.

so answer to this MSQ was only D.
2 flags:
✌ Low quality (Eigen Vector “Ans is D but Explanation is wrong”)
✌ Low quality (parity)
Answer:
Position:
Show:

Related questions

27 27 votes
4 answers 4 answers
18.3k
18.3k views
Arjun asked Feb 15, 2022
18,303 views
Consider a demand paging system with four page frames (initially empty) and $\text{LRU}$ page replacement policy. For the following page reference string$$7, 2, 7, 3, 2, ...