Skip to main content


Home Thrashing

Thrashing

(also disk thrashing)

Thrashing definition

Trashing is overuse of a computer's virtual memory resources. The process causes the system to be in a constant state of paging and page faults, which slows down or stops all but the most basic application-level tasks. The computer's performance suffers or completely breaks down as a result. If the user doesn't close any apps or the processes don't free up more virtual memory, the problem will persist. Since thrashing necessitates data transmission between the hard disk and physical memory, it can slow down system performance. An early sign of thrashing is when a program freezes and the disk drive light flashes on and off. The operating system typically warns the user when virtual memory is low.

Tips on preventing thrashing:

  • Locality model. The term “locality“ refers to a set of frequently visited websites. According to the locality model, a running process hops from one locality to another as it completes its tasks. Consequently, a program typically consists of multiple, potentially overlapping localities.
  • Working-set model. If we provide a process with enough frames to fit its current locality, it will only crash when it transitions to a different locality. However, the operation will inevitably crash if the number of frames allotted is smaller than the current locality's size.
  • Page fault frequency. The idea here is to regulate the page fault rate, which is a major contributor to the issues brought on by thrashing. A high rate of page faults suggests that the process is running out of allotted memory space (frames). On the other hand, a low page defect rate suggests that there are too many frames in the process.

Tips on eliminating thrashing:

  • Adjusting the swap file size. Disk thrashing can occur if the system swap file is not configured appropriately, so it's important to increase its capacity.
  • Increasing RAM. More RAM means less time spent processing data and more time spent doing other things.
  • Minimizing the number of apps running. Too many background apps will drain system resources.
  • Replacing programs. Replace programs that use a lot of memory with similar ones that use less.