Thrashing (original) (raw)

Last Updated : 11 Sep, 2025

Thrashing occurs when the operating system spends more time swapping pages between main memory and disk than executing processes. This leads to excessive page faults and a significant drop in CPU utilization.

The cycle works like this:

This repeated cycle of low CPU utilization → more processes → more page faults is called Thrashing.

Locality Model

The concept of locality of reference helps explain thrashing:

Thrashing happens when active localities of multiple processes cannot fit into memory simultaneously.

Techniques to Handle Thrashing

1. Working Set Model

Based on the Locality Model: a process uses a set of pages (locality) actively at a time.

Cases:

  1. If D > m (m = available frames) i.e Thrashing occurs.
  2. If D ≤ m i.e No thrashing.

Accuracy depends on Δ:

2. Page Fault Frequency

PFF is a technique to control thrashing by directly monitoring the page fault rate of processes.

Working:

  1. Define an upper limit and a lower limit for acceptable page fault rate.
  2. If fault rate > upper limit, give more frames to the process.
  3. If fault rate < lower limit, take away frames.
  4. If no free frames are available suspend some processes and reallocate frames.