446 views

2 Answers

0 votes
0 votes

Find a page frame with the smallest counter. In case of tie, FIFO is to be adopted. No. of page frames available is 4.

Initially, 4 page faults for references 1 2 3 4.

Frame 1 2 3 4

Page 1 2 3 4

Count 1 1 1 1

Then, when 5 comes, all frames have equal count (=1), so we use FIFO to replace page 1. Now faults=5

Frame 1 2 3 4

Page 5 2 3 4

Count 2 1 1 1

Next, 3 and 4 comes, already there. So no fault. Then 1 comes. faults = 6. We replace page 2 (frames 2 3 and 4 have equal count of 1 so we apply FIFO).

Frame 1 2 3 4

Page 5 1 3 4

Count 2 2 1 1

Then 6 comes. faults = 7. We replace 3.

Frame 1 2 3 4

Page 5 1 6 4

Count 2 2 2 1

Then 7 comes. faults = 8. We replace 4.

Frame 1 2 3 4

Page 5 1 6 7

Count 2 2 2 2

Next, 8 comes. Again faults. No. of faults = 9. We replace 5.

Frame 1 2 3 4

Page 8 1 6 7

Count 3 2 2 2

Next 7 and 8 comes. already there, so no fault. Then 9 comes. It faults. No. of faults = 10. We replace 1.

Frame 1 2 3 4

Page 8 9 6 7

Count 3 3 2 2

Next 7 8 and 9 does not fault. Then comes 5. It faults. No. of faults = 11. We replace 6.

Frame 1 2 3 4

Page 8 9 5 7

Count 3 3 3 2

Then comes 4. Faults = 12. We replace 7.

Frame 1 2 3 4

Page 8 9 5 4

Count 3 3 3 3

Next 5 and 4 comes. No fault. Then comes 2. It faults. Faults = 13. We replace 8.

Frame 1 2 3 4

Page 2 9 5 4

Count 4 3 3 3

Therefore, total faults = 13.

0 votes
0 votes
This is nothing But a counter based Page replacement algorithm..and when all counter values are same then ,if we use FCFS

then according to the given string i am getting 13 as answer

so 13 is correct answer

Related questions

0 votes
0 votes
0 answers
1
Niharika 1 asked Dec 4, 2017
212 views
How demand paging makes VAS independent of physical memory??
2 votes
2 votes
2 answers
2
Niharika 1 asked Nov 5, 2016
337 views
0 votes
0 votes
0 answers
3
!KARAN asked Dec 8, 2018
318 views
Let us say we assume last production rule to be $A \rightarrow \epsilon$The language generated by the given grammar will be something like $L = \{c, bcb, b^2cb^2, b^3cb^3...