A system uses FIFO policy for page replacement. It has 4 page frames with no pages loaded to begin with. The system first accesses 50 distinct pages in some order and then accesses the same 50 pages in reverse order. How many page faults will occur?
A system uses FIFO policy for page replacement. It has 4 page frames with no pages loaded to begin with. The system first accesses 50 distinct pages in some order and then accesses the same 50 pages in reverse order. How many page faults will occur? Correct Answer 96
Concept:
In the First In First Out (FIFO) algorithm, the operating system keeps track of all pages in the memory in a queue, the oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal.
Explanation:
Page frames = 4
Pages: 1, 2, 3, 4 .... 45, 46, 47, 48, 49, 50, 50(H), 49(H), 48(H), 47(H), 46, 45, .....4, 3, 2, 1
First 50-page accesses will cause page fault but in reverse order page number 50, 49, 48, and 47 will not cause a page fault.
Hence total page faults are 50 + 46.
Notes:
H→ Hit