# Page fault question

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?

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

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.