GATE / CS ARCHIVE

GATE CSE 2010 / QUESTION 24

FIFO forward and reverse page scan

Operating Systems · Virtual Memory & Paging · Full GATE CSE 2010 paper

GATE 2010, Q24 1 mark · MCQ
Report issue

Virtual Memory & Paging

Question 24, GATE 2010: A FIFO page-replacement system has four frames, initially empty. It accesses 100 distinct pages in some order, then accesses those same 100 pages in the reverse order. How many page faults occur?
Options: (A) 196; (B) 192; (C) 197; (D) 195.
Tap to enlarge
Your answer
Answer & solution

Answer: A (no official key was published)

The first 100 distinct references all fault. The four resident pages are then the last four in forward order, and the reverse scan hits these four first. Every one of the other 96 reverse references is to a page not yet resident; those faults evict only pages already visited in the reverse scan. Therefore faults total 100+96=196, option A. Hits do not refresh FIFO order.

Name the forward sequence p₁,…,p₁₀₀. The reverse sequence starts p₁₀₀,p₉₉,p₉₈,p₉₇, all already resident. Then p₉₆,…,p₁ must each fault because none remains from the forward scan. There are 200 total references and exactly four hits, giving 200−4=196 independently of the original ordering.

Original paper, page 5