📝 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.
📝 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?
📖 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?
📖 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?
📖 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.
📖 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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?
📖 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 , memory access time ns, and page‑fault service time ms, what is the effective memory access time (EAT)?
📖 Explanation: Using : and . 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?
📖 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.