🎓 BookMCQ
← Back to 9. Virtual Memory

📝 Cause of thrashing in Operating System (13 MCQs)

Excessive Page Faults and Loss of Useful Processing

Thrashing is a virtual-memory condition in which a system spends an excessive proportion of its time servicing page faults and transferring pages rather than executing application instructions. It commonly occurs when the combined working sets of active processes exceed available physical memory. Frequent page replacement removes pages that processes soon need again, producing repeated storage activity and sharply reducing useful CPU progress.

How Memory Overcommitment Creates Thrashing

Multiprogramming improves utilisation when enough frames remain available for active processes. However, increasing the number of competing processes beyond physical memory capacity can distribute too few frames to each workload. Their frequently used pages are repeatedly removed and reloaded. The resulting storage traffic increases waiting time, while additional process admission can worsen the original memory shortage.

Repeated Page Replacement and Process Activity

A process references a nonresident page, causing a page fault. The kernel selects a victim frame, potentially removing another process's useful page under global replacement. Later, the displaced process references that page and creates another fault. This cycle continues as processes repeatedly exchange the same small collection of frames without retaining their active working sets.

Two Processes Competing for Insufficient Frames

Suppose P1 and P2 each require eight frequently used pages, but together they receive only ten physical frames. Each process may repeatedly remove pages needed by the other. As the processes alternate between their memory references, faults and storage transfers increase. Providing sufficient frames or reducing active multiprogramming can break this repeated replacement cycle.

CPU Utilisation Collapse and Storage Saturation

Thrashing causes high paging-device activity, long response times, reduced throughput, and poor CPU utilisation. The processor often waits while pages move between RAM and storage. Increasing multiprogramming in response to apparent low CPU utilisation can worsen the condition. Operating systems use working-set estimates, page-fault frequency, and process suspension to maintain a more sustainable relationship between memory demand and available frames.

Distinguishing Thrashing from Ordinary Page Faults

'Any page fault indicates thrashing' is incorrect because occasional faults are normal in demand paging. 'Increasing the number of active processes always improves CPU utilisation' is incorrect because insufficient frames can cause thrashing. 'Adding more disk space directly solves RAM pressure' is incorrect because greater backing-store capacity does not provide the fast physical frames needed by active working sets.

Exam Focus: Recognising and Preventing Thrashing

Identify symptoms such as high page-fault frequency, heavy paging activity, poor throughput, and low useful CPU utilisation. Explain how working-set demand exceeding available frames produces repeated eviction. Compare solutions such as reducing multiprogramming, allocating additional frames, and using working-set or page-fault-frequency control. Distinguish normal demand paging from sustained excessive replacement activity.

Key Terms of Thrashing

  • Thrashing - Excessive paging instead of execution.
  • Working set - Recently active process pages.
  • Page-fault frequency - Rate of page faults.
  • Memory pressure - Demand exceeding available frames.
  • Multiprogramming - Concurrent execution of processes.
  • Throughput - Completed work per time unit.
3
Easy
6
Medium
4
Hard

📝 All Cause of thrashing in Operating System MCQs

Q1. What is the name of the fault that occurs when a process accesses a page with the invalid bit set?

A.Page fault ✅
B.Segmentation fault
C.Bus error
D.General protection fault
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: A page fault is generated whenever the paging hardware finds the invalid bit set for a referenced page. The other choices describe different error conditions unrelated to virtual‑memory paging. Understanding that the invalid‑bit check triggers a trap helps students recognise why the OS must intervene. This directly matches the mechanism that starts the fault‑handling sequence described in the operating‑system model.

Q2. Why does the operating system terminate a process when an invalid page reference is detected?

A.Because the process attempted to read protected kernel memory
B.Because the reference cannot be satisfied by any existing page frame
C.Because the fault indicates a programming error that cannot be corrected by paging ✅
D.Because the OS wants to free memory for other processes
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: When the internal table shows the reference is truly invalid, no amount of paging can make the page available, so the only safe response is termination. Options A and B describe unrelated protection mechanisms, while D is a policy choice not mandated by the fault semantics. Termination prevents undefined behavior and keeps the system stable.

Q3. How does the internal table kept with the process control block help the OS distinguish between valid and invalid page references?

A.It stores the physical address of every page
B.It records the invalid‑bit status for each virtual page ✅
C.It lists the free frames in the system
D.It contains the program’s instruction pointer
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The internal table mirrors the page‑table’s invalid bits, allowing the OS to quickly decide if a fault can be remedied by loading a page or must abort the process. The other options either describe unrelated data (free frames, instruction pointer) or misstate the table’s purpose (physical addresses). This distinction is crucial for correctly handling page faults without unnecessary termination.

Q4. Explain why pure demand paging can cause thrashing when the working set exceeds the number of available frames.

A.Because the OS will pre‑load all pages at start‑up ✅
B.Because each page fault forces a disk read, repeatedly evicting pages still needed
C.Because the CPU slows down due to context switches
D.Because the invalid bit is never cleared
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: When the working set is larger than physical frames, every fault brings in a needed page but must evict another needed page, causing a rapid cycle of faults—thrashing. Pre‑loading (A) does not happen in pure demand paging, and context‑switch overhead (C) is a symptom, not the cause. The invalid bit (D) is unrelated to the repeated replacement behavior.

Q5. What role does the free‑frame list play during page‑fault handling?

A.It determines which process will be scheduled next
B.It provides a pool of unused frames from which the OS can allocate a new page ✅
C.It stores the timestamps of recent page accesses
D.It records the priority of each process
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: When a fault occurs, the OS must find a physical frame to hold the incoming page. The free‑frame list supplies such a frame without needing to replace an existing one, simplifying the allocation step. The other choices describe scheduling, tracking access history, or priority management—functions handled elsewhere in the OS.

Q6. How does restarting the interrupted instruction after a page fault preserve program correctness?

A.It re‑executes the instruction with the newly loaded page now present
B.It skips the faulty instruction and continues with the next one ✅
C.It rewrites the instruction to avoid the faulting address
D.It changes the program’s control flow to a safe routine
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: After the page is loaded and the page table updated, the original instruction can be executed again because its operands are now resident in memory. Skipping (B) would change program semantics, while rewriting (C) or altering control flow (D) would corrupt the intended computation. This restart mechanism ensures the program behaves as if the page had always been present.

Q7. A process with 4 allocated frames repeatedly references pages 1‑5 in a round‑robin pattern. Which outcome is most likely?

A.The process will experience zero page faults after the first five references
B.The process will quickly enter a thrashing state with many page faults
C.The operating system will allocate additional frames automatically ✅
D.The page‑fault handler will terminate the process after the first invalid reference
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: With only four frames but five distinct pages, each reference to the missing page forces a replacement, causing a fault on almost every access—classic thrashing. The first option is impossible because the working set exceeds available frames. Automatic frame allocation (C) does not occur without explicit policy, and termination (D) only happens for truly invalid accesses, not for normal demand paging.

Q8. If the OS begins pre‑fetching the next likely page after a fault, what effect does this have on the overall page‑fault rate?

A.It increases the fault rate because more pages are read unnecessarily ✅
B.It decreases the fault rate by having pages ready before they are referenced
C.It has no effect because pre‑fetching is ignored by the hardware
D.It causes the system to run out of memory instantly
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Pre‑fetching aims to anticipate future references, so the required page is already in memory when the CPU accesses it, reducing faults. An increase (A) would only happen if the prediction is terrible, which the question does not imply. Hardware does not ignore pre‑fetch requests (C), and memory exhaustion (D) would require extreme over‑fetching, not typical in a modest pre‑fetch scheme.

Q9. During page‑fault handling, which step is missing if the OS fails to update the page table after the disk read completes?

A.Finding a free frame ✅
B.Scheduling the disk operation
C.Modifying the internal table and page table to mark the page as resident
D.Restarting the interrupted instruction
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: If the page table is not updated, the CPU will continue to see the page as invalid, causing another fault on the next access. Finding a free frame (A) and scheduling the disk I/O (B) occur earlier, while restarting the instruction (D) happens after the table update. The missing update directly leads to repeated faults, undermining the whole handling process.

Q10. Given the reference string 7, 0, 1, 2, 0, 3, 0, 4 and three frames using FIFO replacement, how many page faults occur?

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

📖 Explanation: Step‑by‑step: fault on 7 (1), 0 (2), 1 (3), 2 replaces 7 (4), 0 already present, 3 replaces 0 (5), 0 replaces 1 (6), 4 replaces 2 (7). Thus seven faults. Options A, C, and D are off by one or two, showing common counting errors. Knowing the replacement order is essential for correct fault calculation.

Q11. A system with 4 frames uses LRU replacement. For the reference string 1,2,3,4,1,2,5,1,2,3,4,5, which reference most directly triggers thrashing?

A.Reference to page 5 at position 7
B.Reference to page 1 at position 5 ✅
C.Reference to page 3 at position 10
D.Reference to page 4 at position 12
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: When page 5 is first requested, the frames contain 1,2,3,4; LRU evicts the least recently used page (4), causing a fault. Subsequent accesses to 1,2,3,4 again each cause a fault, creating a rapid fault cycle—thrashing. The earlier references (B) do not cause eviction, and later references (C, D) occur after the thrashing has already begun.

Q12. If the page‑fault rate is p=0.02p = 0.02, memory access time tm=100t_{m}=100 ns, and page‑fault service time tpf=8t_{pf}=8 ms, what is the effective memory access time (EAT)?

A.2.02.0 µs ✅
B.162162 µs
C.8.028.02 ms
D.8.28.2 ms
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Using EAT=(1−p)×tm+p×tpf\text{EAT} = (1-p) \times t_{m} + p \times t_{pf}: (1−0.02)×100ns=98ns(1-0.02)\times100\text{ns}=98\text{ns} and 0.02×8ms=0.16ms=160µs0.02\times8\text{ms}=0.16\text{ms}=160\text{µs}. Sum ≈ 162 µs. Option A mis‑places units, C ignores the memory component, D adds too much. This calculation shows how even a small fault rate dramatically inflates access time, illustrating why thrashing must be avoided.

Q13. If the OS mistakenly sets the invalid bit for a valid page, what symptom is most likely to appear?

A.The process will run faster because fewer pages are loaded
B.The process will be terminated immediately on first access to that page ✅
C.The system will ignore the fault and continue execution
D.The page will be swapped out repeatedly without faulting
💡 Difficulty: hard | ✅ Correct: B

📖 Explanation: Marking a valid page as invalid causes the hardware to raise a page fault each time the page is accessed. Because the OS believes the reference is illegal, it will terminate the process rather than load the page. The other options describe opposite behaviors or no‑fault scenarios, which do not match the described error.

🔗 Related Topics (MCQs)