Why OPR is best but not pratically fessible page replacement algorithm? Calculate the number of page faults for OPR, LRU and Clock page replacement algorithm for the reference string: 1, 3, 4, 2, 3, 5, 4, 3, 1, 2, 4, 6, 3, 2, 1, 4, 2. Assume the memory size is 3.

This answer is restricted. Please login to view the answer of this question.

Login Now

Optimal page replacement is best because

  1. It is less complex and easy to implement.
  2. A page is replaced with minimum fuss.
  3. Simple data structures are used for this purpose.
  4. Lower page fault rate.
  5. Never suffers from Belady’s anomaly.

But It is not pratically fessible page replacement algorithm because

  1. Not all operating systems can implement this algorithm.
  2. Error detection is harder.
  3. Least recently used page will be replaced which may sometimes take a lot of time.

Problem Part:

The number of page faults for OPR, LRU and Clock page replacement algorithm for the reference string: 1, 3, 4, 2, 3, 5, 4, 3, 1, 2, 4, 6, 3, 2, 1, 4, 2 is given below

OPR:

1 3 4 2 3 5 4 3 1 2 4 6 3 2 1 4 1
1 1 1 2 2 5 5 5 1 2 2 2 2 2 2 2 2
3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4
4 4 4 4 4 4 4 4 4 6 6 6 1 1 1
* * * * * * *

Total page hit = 7

Total page fault = 17 – 7 = 10

LRU:

1 3 4 2 3 5 4 3 1 2 4 6 3 2 1 4 1
1 1 1 2 2 2 4 4 4 2 2 2 3 3 3 4 4
3 3 3 3 3 3 3 3 3 4 4 4 2 2 2 2
4 4 4 5 5 5 1 1 1 6 6 6 1 1 1
* * *

Total page hit = 3

Total page fault = 17 – 3 = 14

Clock Page Replacement:

1 3 4 2 3 5 4 3 1 2 4 6 3 2 1 4 1
1(0) 1(0) 1(0) 2(0) 2(0) 2(0) 4(0) 4(0) 4(0) 2(0) 2(0) 2(0) 3(0) 3(0) 3(0) 4(0) 4(0)
3(0) 3(0) 3(0) 3(1) 3(0) 3(0) 3(1) 3(0) 3(0) 4(0) 4(0) 4(0) 2(0) 2(0) 2(0) 2(1)
4(0) 4(0) 4(0) 5(0) 5(0) 5(0) 1(0) 1(0) 1(0) 6(0) 6(0) 6(0) 1(0) 1(0) 1(0)
* * *

Total page hit = 3

Total page fault = 17 – 3 = 14

If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

Discussion
0 Comments
  Loading . . .