in Operating System edited by
12,133 views
23 votes
23 votes

A system uses FIFO policy for system replacement. It has $4$ page frames with no pages loaded to begin with. The system first accesses $100$ distinct pages in some order and then accesses the same $100$ pages but now in the reverse order. How many page faults will occur?

  1. $196$
  2. $192$
  3. $197$
  4. $195$
in Operating System edited by
12.1k views

1 comment

same number of page faults  for any other algo (LRU , OPT)
1
1

2 Answers

41 votes
41 votes
Best answer

Answer is (A).

When we access $100$ distinct page in some order (for example $1,2,3\ldots 100$) then total number of page faults $=100$. At last, the $4$ page frames will contain the pages $100,99,98$ and $97$. When we reverse the string $(100,99,98,\ldots,1)$ then first four page accesses will not cause the page fault because they are already present in page frames. But the remaining $96$ page accesses will cause $96$ page faults. So, total number of page faults $=100+96=196$.

edited by

3 Comments

edited by

$\text{Page fault} = 100 + 96\:\text{(reverse order)} = 196$

7
7
Why first four misses are not included even though frame is empty ?
1
1
Please look carefully included,

in the first time all 100 frames are included as a fault but while in reverse order 100, 99, 98, 97 are not included(as they hits) so, in reverse order only 96 faults, 100+96= 196 total page faults
0
0
1 vote
1 vote
Answer will be "196" first 100 page fault will occur then 4 page hit after that 96 page fault total =100+96

If you want to visualize how this mapping take small value and check

1)Lets take 5 district element and its reveverse then page fault 5(page fault) + 4(page hit)+1 (page fault)

Total page fault=6

2) let's take 10 district element and its reveverse then 10(page fault)+4(page hit) +6(page fault)

Total page fault=16
edited by

1 comment

Nice Explanation
0
0
Answer:

Related questions