Thrashing (computer science)

The situation can continue indefinitely until the user closes some running applications or the active processes free up additional virtual memory resources.

As the total of the working sets grows, resolving page faults remains manageable until the growth reaches a critical point at which the number of faults increases dramatically and the time spent resolving them overwhelms the time spent on the computing the program was written to do.

Thrashing may occur on a program that randomly accesses huge data structures, as its large working set causes continual page faults that drastically slow down the system.

The term is also used for various similar phenomena, particularly movement between other levels of the memory hierarchy, wherein a process progresses slowly because significant time is being spent acquiring resources.

"Thrashing" is also used in contexts other than virtual memory systems –for example, to describe cache issues in computing, or silly window syndrome in networking.

Virtual memory works by treating a portion of secondary storage such as a computer hard disk as an additional layer of the cache hierarchy.

Depending on the configuration and algorithms involved, the throughput and latency of a system may degrade by multiple orders of magnitude.

In virtual memory systems, thrashing may be caused by programs or workloads that present insufficient locality of reference: if the working set of a program or a workload cannot be effectively held within physical memory, then constant data swapping, i.e., thrashing, may occur.

A system thrashing is often a result of a sudden spike in page demand from a small number of running programs.

In this updated swap-token implementation, a priority counter is set for each process to track the number of swap-out pages.