2,841 views
0 votes
0 votes

Demand paging uses a second chance page replacement policy (clock). It uses one use bit to give every page one more chance in FIFO replacement. Whenever a page is referenced its use bit set to 0. Whenever it is need to replace by other page for the first time then its use bit is changed to 1 and next page will be searched for replacement. If already given the chance then it will be replaced.
Assume that the system has 3 page frames. Consider the following page reference stream in the given order.
                                                              7, 0, 1, 2, 0, 3, 0, 4, 2, 3
The number of page faults occur using clock algorithm are ___________.

3 Answers

Best answer
5 votes
5 votes

Considering, when new page read into a memory frame has the second chance bit set to ZERO (0) and Each time a memory frame is referenced, set the "second chance" bit to ONE (1) - this will give the frame a second chance.

Here, PF = Page Fault, SC = Second Chance

So, Total Page Fault is 8. 

selected by
4 votes
4 votes
7-0  7-0  7-0   2-0   2-0  2-0   2-0   4-0   4-0   4-0
       0-0  0-0   0-0   0-1  0-0   0-1   0-0   2-0    2-0
              1-0   1-0   1-0  3-0   3-0   3-0   3-0    3-1
M     M    M     M      H    M      H     M     M      H

Threrfore 7 page fault.
0 votes
0 votes
I am getting 7 as answer.

Related questions

0 votes
0 votes
0 answers
4
Jyoti Kumari97 asked Jan 15, 2019
529 views
Assume there are 5 frames and consider the following reference string find the number of page faults using NRU page replacement algorithm.3,2,3, 0,8,4,2,5,0,9,8,3,2