0
$\begingroup$

How many page faults are there in the following accesses of pages in case of FIFO mechanism where page frame size is 8? $$11,21,23,53,8,7,10,3,3,38,3,37,7$$

Soln: This question appeared in one of my the entrance tests for a company and I am pretty sure I got it right but there was no option matching what I had thought. Am I going wrong somewhere?

My approach: first 8 will fail next when we replace the new ones we shall replace from the beginning since FIFO mechanism, so basically we first search for the newly found page in the frame and if not present we pop off the first one from the frame and add new ones at the back. Is this right?

$\endgroup$
5
  • $\begingroup$ "First 8 will fail" only if all the frames are distinct. $\endgroup$
    – Rinkesh P
    Aug 4 at 5:14
  • $\begingroup$ what do you mean? $\endgroup$
    – Charlie
    Aug 4 at 13:15
  • $\begingroup$ frame 7 doesn't cause a page fault if frame 7 is already mapped $\endgroup$
    – user253751
    Aug 4 at 13:26
  • $\begingroup$ yeah yeah, i meant that btw, so the algorithm i mentioned to map page faults is correct? $\endgroup$
    – Charlie
    Aug 4 at 20:13
  • $\begingroup$ maybe i will just change the example $\endgroup$
    – Charlie
    Aug 4 at 20:14

1 Answer 1

1
$\begingroup$
Page Number Frame Contents Page Fault
11 11 +1
21 11, 21 +1
23 11, 21, 23 +1
53 11, 21, 23, 53 +1
8 11, 21, 23, 53, 8 +1
7 11, 21, 23, 53, 8, 7 +1
10 11, 21, 23, 53, 8, 7,10 +1
3 11, 21, 23, 53, 8, 7, 10, 3 +1
3 11, 21, 23, 53, 8, 7, 10, 3
38 38, 21, 23, 53, 8, 7, 10, 3 +1
3 38, 21, 23, 53, 8, 7, 10, 3
37 38, 37, 23, 53, 8, 7, 10, 3 +1
7 38, 37, 23, 53, 8, 7, 10, 3

Total Page Faults=10.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.