🎓 BookMCQ
← Back to 9. Virtual Memory

📝 FIFO page replacement (11 MCQs)

First-In First-Out Ordering of Resident Pages

First-In First-Out page replacement is a memory-management algorithm that removes the page that has remained in physical memory for the longest time. It maintains pages in arrival order, commonly using a queue or circular pointer. When a new page must enter a full set of frames, the oldest resident page becomes the victim regardless of how recently or frequently it was accessed.

Why Arrival Order Provides a Simple Replacement Rule

Page replacement requires a practical decision about which resident contents should be removed. FIFO uses arrival time rather than estimating future references or tracking recent usage. This simplicity reduces bookkeeping requirements compared with sophisticated policies. However, it ignores locality and may remove a heavily used page simply because it entered memory earlier than other pages.

Queue Updates During FIFO Page Replacement

When a referenced page is already resident, no replacement occurs and the queue order remains unchanged. On a fault, the operating system inserts the requested page into an available frame if one exists. When all frames are occupied, it removes the queue's oldest page and places the incoming page in the released frame, updating the queue position.

Tracing FIFO with Three Physical Frames

Consider the reference string 1, 2, 3, 1, 4 with three initially empty frames. Pages 1, 2, and 3 occupy the frames in arrival order. The second reference to 1 is a hit and does not change FIFO order. When page 4 arrives, page 1 is removed because it entered memory first, despite its recent access.

Low Implementation Cost and Belady Anomaly

FIFO is straightforward to implement and requires little information beyond page arrival order. However, it may produce unnecessary faults because it does not consider recent use. It also exhibits Belady's anomaly, in which increasing the number of frames can increase page faults for certain reference strings. This behaviour distinguishes FIFO from stack algorithms such as LRU and optimal replacement.

Common Mistakes About FIFO Queue Behaviour

'FIFO removes the least recently used page' is incorrect because it removes the oldest arrival. 'A page hit moves the page to the newest position' is incorrect because FIFO preserves insertion order. 'Adding frames always reduces FIFO faults' is incorrect because Belady's anomaly demonstrates that additional frames can sometimes increase the fault count.

Exam Focus: FIFO Traces and Belady Anomaly

Draw the frame queue for every reference and preserve arrival order after page hits. Count initial loading and replacement faults separately when required. Practise comparing fault counts with different frame capacities to identify Belady's anomaly. Do not move a referenced page to the rear of the queue unless the question specifies another algorithm such as LRU.

Key Terms of FIFO Replacement

  • FIFO - Removes the oldest resident page.
  • Queue - Maintains page arrival order.
  • Page hit - Reference finds a resident page.
  • Page fault - Reference requires a missing page.
  • Belady anomaly - More frames can increase faults.
  • Victim - Page removed during replacement.
3
Easy
5
Medium
3
Hard

📝 All FIFO page replacement MCQs

Q1. A system has three physical frames. The page reference string is 1, 2, 3, 4, 1, 2, 5. Using FIFO replacement, which page is evicted when the reference to page 5 occurs?

A.1
B.2
C.3
D.4 ✅
💡 Difficulty: easy | ✅ Correct: D

📖 Explanation: Using FIFO, pages are removed in the order they entered memory. The three frames first hold pages 1, 2, 3. When page 4 arrives, page 1—the oldest—is evicted. Subsequent references bring back pages 1 and 2, each evicting the next oldest page. By the time page 5 is referenced, page 4 is the oldest resident page, so it is replaced. Thus the evicted page is 4, making option D correct. The other options name pages that remain in memory or are not the oldest.

Q2. A system with four frames receives the reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2. Using FIFO, how many page faults occur?

A.6
B.7 ✅
C.8
D.9
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: FIFO fills the four frames with the first four distinct pages: 7, 0, 1, 2. The next reference to 0 hits. When 3 is requested, the oldest page 7 is evicted, causing a fault. The reference to 0 hits again, then 4 causes a fault by evicting 0. The later references to 2 and 3 hit, but the next reference to 0 faults because page 1 was evicted earlier. Counting all faults gives seven, so option B is correct; the other counts miss at least one fault or add extra.

Q3. A program generates 100 page references. With FIFO replacement using 5 frames, it incurs 20 page faults. What is the page fault rate? Additionally, after these references, the FIFO queue holds pages {A,B,C,D,E} in that order, where A is the oldest. If the next reference is to page F, which page will be evicted?

A.A ✅
B.B
C.C
D.D
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: The fault rate is the number of faults divided by total references, so 20100=0.20\frac{20}{100}=0.20 or 20 %. The FIFO queue order tells us the oldest resident page is A. When page F is requested, FIFO evicts the oldest page, which is A, and loads F. Therefore the evicted page is A, making option A correct. Options B‑D name newer pages that would not be removed under FIFO.

Q4. Process X has pages 0‑4 on disk, and the system uses a lazy pager with FIFO replacement and 2 frames. The first page reference is to page 3, then to page 1, then to page 4. Which pages will be in memory after the third reference?

A.3 and 1
B.1 and 4 ✅
C.3 and 4
D.4 and 1
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Initially both frames are empty. The reference to page 3 loads it, occupying the first frame. The next reference to page 1 loads it into the second frame, establishing the FIFO order: 3 (oldest) then 1. When page 4 is requested, FIFO evicts the oldest page, which is 3, and loads 4. Consequently the frames contain pages 1 and 4, matching option B. The other options either retain the evicted page or list an incorrect pair.

Q5. Given the reference string 1,2,3,4,1,2,5,1,2,3,4,5, a FIFO algorithm yields 9 page faults with 3 frames. How many faults occur with 4 frames?

A.8
B.9
C.10 ✅
D.11
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: Simulating FIFO with four frames: the first four distinct pages (1, 2, 3, 4) fill the frames, each causing a fault. The next two references (1, 2) hit. Reference to 5 evicts the oldest page 1, fault. Subsequent references to 1, 2, 3, 4 each cause faults because the required pages have been evicted earlier. Finally, referencing 5 again faults after evicting page 4. Counting all faults gives ten, so option C is correct; the other numbers underestimate or overestimate the actual faults.

Q6. In a demand‑paging system using FIFO, a page‑table entry has its valid bit cleared when the page is evicted. If a process subsequently accesses that page, what sequence of events occurs?

A.Page fault, FIFO selects victim, page loaded, valid bit set ✅
B.Page is found in memory, no fault
C.Operating system ignores the request
D.Page is swapped out immediately
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: When the valid bit is cleared, the hardware signals that the page is not resident. A reference to that page triggers a page fault. The operating system then runs the FIFO algorithm to choose the oldest resident page as the victim, writes it back if dirty, loads the needed page into the freed frame, and finally sets the valid bit. Thus the described sequence matches option A. The other choices either deny the fault or describe behavior that does not occur.

Q7. Why can the FIFO page‑replacement algorithm suffer Belady's anomaly?

A.Because it does not consider future references ✅
B.Because it uses LRU ordering
C.Because it updates timestamps
D.Because it uses only one frame
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: FIFO replaces the page that has been in memory the longest without looking at upcoming references. This lack of foresight can cause a situation where adding more frames introduces a replacement order that produces more faults, which is the essence of Belady's anomaly. Options B and C describe strategies that do consider usage history, while D is unrelated. Therefore option A correctly explains the anomaly.

Q8. How do the valid‑invalid bits interact with FIFO replacement in a demand‑paging system?

A.Valid bits identify which pages are candidates for FIFO replacement ✅
B.Invalid bits tell the system which pages are in memory
C.Valid bits are irrelevant to FIFO
D.Invalid bits cause immediate eviction
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A valid bit set to 1 indicates that the page currently resides in a physical frame, making it eligible for FIFO tracking. The FIFO queue maintains the order of these valid pages to decide which one to evict next. When a page is invalid (bit 0), it is known to be on disk and not part of the FIFO list. Hence option A correctly captures the relationship; the other statements either reverse the meaning or claim no relevance.

Q9. Compared to LRU, what is a primary implementation advantage of FIFO?

A.FIFO requires only a queue, LRU needs timestamps or a stack ✅
B.FIFO needs more hardware than LRU
C.LRU has lower miss rate but higher implementation cost
D.Both have identical overhead
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: FIFO can be implemented with a simple circular queue that records the order pages entered memory, needing only a pointer to the oldest entry. LRU, however, must track recent usage, which typically requires timestamps, a stack, or additional hardware to maintain ordering, increasing complexity and cost. Option A describes this advantage accurately. Options B and D are false, and while C is partly true, it does not address the implementation difference directly.

Q10. What is the definition of the FIFO page‑replacement algorithm?

A.Replace the page that has been in memory the longest ✅
B.Replace the page that was most recently used
C.Replace a random page
D.Replace the page with the smallest address
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: FIFO stands for First‑In‑First‑Out. The algorithm always removes the page that entered physical memory earliest, i.e., the one that has been resident the longest. This rule is independent of how often or recently the page was accessed. Options B and C describe different strategies (LRU and random), while D is unrelated. Therefore option A correctly defines FIFO.

Q11. If the number of frames allocated to a process is doubled while using FIFO, what is the most likely impact on the page‑fault rate?

A.It will definitely decrease
B.It may stay the same or decrease, but never increase
C.It could increase due to Belady's anomaly ✅
D.It will always increase
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: Increasing the frame count generally gives the process more room, which often reduces faults, but FIFO can exhibit Belady's anomaly where more frames paradoxically cause more faults. Hence the fault rate might rise, making option C the most accurate. Option A is too absolute, option B ignores the anomaly, and option D contradicts typical behavior. The answer reflects the nuanced effect of frame size on FIFO performance.

🔗 Related Topics (MCQs)