What is thrashing, and how can it be controlled?
Interview preparation resource from Gate Smashers.
Thrashing occurs when processes do not have enough frames for their active working sets, so the system spends most of its time servicing page faults instead of executing useful instructions.
When a process repeatedly evicts pages it will need again soon, page-fault frequency rises and storage activity becomes very high. CPU utilization may fall, which can mislead a naive scheduler into admitting even more processes and making the problem worse.
The OS can reduce the degree of multiprogramming, allocate more frames, prefer local replacement or suspend processes. Working-set models estimate the pages actively used during a recent window, while page-fault-frequency control adjusts allocation when a process crosses configured thresholds.
The OS responds by reducing the number of competing processes, allocating more frames or using a working-set style policy that protects actively used pages. The objective is to restore locality so processes spend most of their time executing rather than repeatedly faulting.
