Thrashing

22 Jul 2019

Thrashing

Thrashing describes a situation of repeated page faulting. This significantly slows down performance of the entire system and is to be avoided. It occurs when a process’ allocated number of frames is less than the size of its recently accessed set of frames. When this happens, each page access causes a page fault, so the page must be replaced and new page is loaded from disk. But then the next page access is also not in memory, causing another page fault, resulting in a domino effect of page faults (thrashing). A process spends more time page faulting to disk than executing, causing a severe performance penalty.

Thrashing under global replacement;

  • A process needs more frames, page faults, and takes frames away from other processes, which then take frames from others (domino effect).
  • As processes queue up for the disk, CPU utilization drops.
  • The process isolation is not perfect. A process’s disk reads and writes will slow down other processes that also have disk I/Os
  • OS can add fuel to the fire:
    • Suppose OS has the policy that if it notices CPU utilization dropping, then it thinks that the CPU is free, so it restarts some processes that have been frozen in swap space.
    • These new processes page fault more, causing CPU utilization to drop even further.
Top