Thrashing (computer science)

From Wikipedia, the free encyclopedia
  (Redirected from Thrash (computer science))
Jump to: navigation, search

In computer science, the term thrashing is a colloquialism normally used to describe a computer whose virtual memory subsystem is in a constant state of paging, rapidly exchanging data in memory for data on disk, to the exclusion of most application-level processing.[1] This causes the performance of the computer to degrade or collapse. The situation may not resolve itself quickly, but can continue indefinitely until the underlying cause is addressed.

[edit] Overview

If a process does not have "enough" pages, the page-fault rate is high. This leads to low CPU utilization. In modern computers, thrashing may occur in the paging system (if there is not 'sufficient' physical memory or the disk access time is overly long), or in the communications system (especially in conflicts over internal bus access), etc. 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. The term was first used during the tape operating system days to describe the sound the tapes made when data was being rapidly written to and read from them. Many older low-end computers have insufficient RAM (memory) for modern usage patterns and increasing the amount of memory can often cause the computer to run noticeably faster. This speed increase is due to the reduced amount of swapping necessary.

An example of this sort of situation occurred on the IBM System/370 series mainframe computer, in which a particular instruction could consist of an execute instruction, which crosses a page boundary, that the instruction points to a move instruction, that itself also crosses a page boundary, targeting a move of data from a source that crosses a page boundary, to a target of data that also crosses a page boundary. The total number of pages thus being used by this particular instruction is eight, and all eight pages must be present in memory at the same time. If the operating system allocates less than eight pages of actual memory in this example, when it attempts to swap out some part of the instruction or data to bring in the remainder, the instruction will again page fault, and it will thrash on every attempt to restart the failing instruction.

To resolve thrashing due to excessive paging, a user can do any of the following.

  1. Increase the amount of RAM in the computer (generally the best long-term solution).
  2. Decrease the number of programs being run on the computer.
  3. Replace programs that are memory-heavy with equivalents that use less memory.

The term is also used when a small set of faster storage space, intended to be used to speed up access to a larger set of slower storage space, is accessed in a way that cancels out any benefits from the faster storage. An example of this is cache thrashing, where main memory is accessed in a pattern that leads to multiple main memory locations competing for the same cache lines, resulting in excessive cache misses. This is most problematic for caches that have low associativity. Quite similar is TLB thrashing, where the TLB is overrun by more requests than it can handle efficiently.

[edit] See also

[edit] References

  1. ^ Denning, Peter J. (1968). "Thrashing: Its causes and prevention". Proceedings AFIPS, Fall Joint Computer Conference 33: 915-922. http://www.cs.uwaterloo.ca/~brecht/courses/702/Possible-Readings/vm-and-gc/thrashing-denning-afips-1968.pdf. Retrieved 2012-02-15. 
Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export
Languages