Thrashing (computer science)

In computer science, thrashing occurs in a system with virtual memory when a computer's real storage resources are overcommitted, leading to a constant state of paging and page faults, slowing most application-level processing.[1] This causes the performance of the computer to degrade or collapse. The situation can continue indefinitely until the user closes some running applications or the active processes free up additional virtual memory resources.

After initialization, most programs operate on a small number of code and data pages compared to the total memory the program requires. The pages most frequently accessed at any point are called the working set, which may change over time.

When the working set is not significantly greater than the system's total number of real storage page frames, virtual memory systems work most efficiently, and an insignificant amount of computing is spent resolving page faults. 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. This condition is referred to as thrashing. 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. Satisfying page faults may require freeing pages that will soon have to be re-read from disk.

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.

Overview

Virtual memory works by treating a portion of secondary storage such as a computer hard disk as an additional layer of the cache hierarchy. Virtual memory allows processes to use more memory than is physically present in main memory. Operating systems supporting virtual memory assign processes a virtual address space and each process refers to addresses in its execution context by a so-called virtual address. To access data such as code or variables at that address, the process must translate the address to a physical address in a process known as virtual address translation. In effect, physical main memory becomes a cache for virtual memory, which is in general stored on disk in memory pages.

Programs are allocated a certain number of pages as needed by the operating system. Active memory pages exist in both RAM and on disk. Inactive pages are removed from the cache and written to disk when the main memory becomes full.

If processes are utilizing all main memory and need additional memory pages, a cascade of severe cache misses known as page faults will occur, often leading to a noticeable lag in the operating system responsiveness. This process together with the futile, repetitive page swapping that occurs is known as "thrashing". This frequently leads to high, runaway CPU utilization that can grind the system to a halt. 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 I/O communications subsystem (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. Thrashing is when the CPU performs 'productive' work less and 'swapping' work more. The overall memory access time may increase since the higher level memory is only as fast as the next lower level in the memory hierarchy.[2] The CPU is busy swapping pages so much that it cannot respond to users' programs and interrupts as much as required. Thrashing occurs when there are too many pages in memory, and each page refers to another page. Real memory reduces its capacity to contain all the pages, so it uses 'virtual memory'. When each page in execution demands that page that is not currently in real memory (RAM) it places some pages on virtual memory and adjusts the required page on RAM. If the CPU is too busy doing this task, thrashing occurs.

Causes

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. A worst case might occur on VAX processors. A single MOVL crossing a page boundary could have a source operand using a displacement deferred addressing mode, where the longword containing the operand address crosses a page boundary, and a destination operand using a displacement deferred addressing mode, where the longword containing the operand address crosses a page boundary, and the source and destination could both cross page boundaries. This single instruction references ten pages; if not all are in RAM, each will cause a page fault. The total number of pages thus involved in this particular instruction is ten, and all ten pages must be simultaneously present in memory. If any one of the ten pages cannot be swapped in (for example to make room for any of the other pages), the instruction will fault, and every attempt to restart it will fail until all eight pages can be swapped in.

A system thrashing is often a result of a sudden spike in page demand from a small number of running programs. Swap-token[3] is a lightweight and dynamic thrashing protection mechanism. The basic idea is to set a token in the system, which is randomly given to a process that has page faults when thrashing happens. The process that has the token is given a privilege to allocate more physical memory pages to build its working set, which is expected to quickly finish its execution and release the memory pages to other processes. A timestamp is used to hand over the tokens one by one. The first version of swap-token is implemented in Linux. The second version is called preempt swap-token. In this updated swap-token implementation, a priority counter is set for each process to track the number of swap-out pages. The token is always given to the process with a high priority, which has a high number of swap-out pages. The length of the time stamp is not a constant but is determined by the priority: the higher the number of swap-out pages of a process, the longer the time stamp for it will be.

Other uses

Thrashing is best known in the context of memory and storage, but analogous phenomena occur for other resources, including:

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.
TLB thrashing
Where the translation lookaside buffer (TLB) acting as a cache for the memory management unit (MMU) which translates virtual addresses to physical addresses is too small for the working set of pages. TLB thrashing can occur even if instruction cache or data cache thrashing is not occurring because these are cached in different sizes. Instructions and data are cached in small blocks (cache lines), not entire pages, but address lookup is done at the page level. Thus even if the code and data working sets fit into the cache, if the working sets are fragmented across many pages, the virtual address working set may not fit into TLB, causing TLB thrashing.
Heap thrashing
Frequent garbage collection, due to failure to allocate memory for an object, due to insufficient free memory or insufficient contiguous free memory due to memory fragmentation is referred to as heap thrashing.[4]
Process thrashing
A similar phenomenon occurs for processes: when the process working set cannot be coscheduled – so not all interacting processes are scheduled to run at the same time – they experience "process thrashing" due to being repeatedly scheduled and unscheduled, progressing only slowly.[5]

See also

  • Page replacement algorithm – Algorithm for virtual memory implementation
  • Congestion collapse – Reduced quality of service due to high network traffic
  • Resource contention – In computing, a conflict over access to a shared resource
  • Out of memory – State of computer operation where no additional memory can be allocated
  • Software aging – Tendency of software to fail due to external changes or prolonged operation

References

  1. ^ Denning, Peter J. (1968). "Thrashing: Its causes and prevention" (PDF). Proceedings AFIPS, Fall Joint Computer Conference. 33: 915–922. Retrieved 2012-02-15.
  2. ^ L., Hennessy, John (2012). Computer architecture: a quantitative approach. Patterson, David A., Asanović, Krste. (5th ed.). Waltham, MA: Morgan Kaufmann. ISBN 9780123838728. OCLC 755102367.{{cite book}}: CS1 maint: multiple names: authors list (link)
  3. ^ Song Jiang, and Xiaodong Zhang (2005). "Token-ordered LRU: an effective page replacement policy and its implementation in Linux systems". Performance Evaluation. pp. 5–29. doi:10.1016/j.peva.2004.10.002.
  4. ^ Performance Optimization and Tuning Techniques for IBM Processors, including IBM POWER8, "heap+thrashing" p. 170
  5. ^ Ousterhout, J. K. (1982). "Scheduling Techniques for Concurrent Systems" (PDF). Proceedings of Third International Conference on Distributed Computing Systems. pp. 22–30.

Read other articles:

Artikel ini sudah memiliki daftar referensi, bacaan terkait, atau pranala luar, tetapi sumbernya belum jelas karena belum menyertakan kutipan pada kalimat. Mohon tingkatkan kualitas artikel ini dengan memasukkan rujukan yang lebih mendetail bila perlu. (Pelajari cara dan kapan saatnya untuk menghapus pesan templat ini) Bagian dari seri mengenaiKepercayaan tradisional Tionghoa Konsep Taidi 太帝 Tian 天—Shangdi 上帝 Qi 气 Shen 神 Ling 灵 Xian ling 显灵 Yinyang 阴阳 Hundun Naga 龙 da…

Hungarian and Czech aeronautical engineers The PKZ-2 hovering at a height of 50 m in 1918 Petróczy, Kármán and Žurovec were Hungarian and Czech[1][2] engineers who worked on helicopter development immediately before and during World War I in Budapest. Between them they produced two experimental prototypes, the PKZ-1 and PKZ-2, intended to replace the dangerous hydrogen-filled observation balloons then in use. As such, these craft were tethered on long cables and were not…

Sceaux 行政国 フランス地域圏 (Région) イル=ド=フランス地域圏県 (département) オー=ド=セーヌ県郡 (arrondissement) アントニー郡小郡 (canton) 小郡庁所在地INSEEコード 92071郵便番号 92330市長(任期) フィリップ・ローラン(2008年-2014年)自治体間連合 (fr) メトロポール・デュ・グラン・パリ人口動態人口 19,679人(2007年)人口密度 5466人/km2住民の呼称 Scéens地理座標 北緯48度46…

Sceaux 行政国 フランス地域圏 (Région) イル=ド=フランス地域圏県 (département) オー=ド=セーヌ県郡 (arrondissement) アントニー郡小郡 (canton) 小郡庁所在地INSEEコード 92071郵便番号 92330市長(任期) フィリップ・ローラン(2008年-2014年)自治体間連合 (fr) メトロポール・デュ・グラン・パリ人口動態人口 19,679人(2007年)人口密度 5466人/km2住民の呼称 Scéens地理座標 北緯48度46…

Sceaux 行政国 フランス地域圏 (Région) イル=ド=フランス地域圏県 (département) オー=ド=セーヌ県郡 (arrondissement) アントニー郡小郡 (canton) 小郡庁所在地INSEEコード 92071郵便番号 92330市長(任期) フィリップ・ローラン(2008年-2014年)自治体間連合 (fr) メトロポール・デュ・グラン・パリ人口動態人口 19,679人(2007年)人口密度 5466人/km2住民の呼称 Scéens地理座標 北緯48度46…

Сельское поселение России (МО 2-го уровня)Новотитаровское сельское поселение Флаг[d] Герб 45°14′09″ с. ш. 38°58′16″ в. д.HGЯO Страна  Россия Субъект РФ Краснодарский край Район Динской Включает 4 населённых пункта Адм. центр Новотитаровская Глава сельского посел…

Duryodanaदुर्योधनTokoh Duryodana yang diperankan dalam Yakshagana, sebuah drama populer dari Karnataka, India.Tokoh MahabharataNamaDuryodanaEjaan Dewanagariदुर्योधनEjaan IASTDuryodhanaNama lainSuyodana, Kurunata, Kurupati, Gandarisuta, DretarastraputraKitab referensiMahabharataAsalHastinapura, Kerajaan KuruKediamanHastinapuraKastakesatriaDinastiKuruSenjatagadaAyahDretarastraIbuGandariIstriBanowati dan MayuriwatiAnakLaksmanakumara dan Laksmana Duryodana (Dewanagari…

تاريخ السعوديةمعلومات عامةالمنطقة السعودية وصفها المصدر دارة الملك عبد العزيز التأثيراتأحد جوانب السعودية فرع من تاريخ الشرق الأوسط تعديل - تعديل مصدري - تعديل ويكي بيانات جزء من سلسلة حول تاريخ السعودية عصور ما قبل التاريخ تاريخ شبه الجزيرة العربية الممالك العربية قبل ال…

 AG7  SP7  KJ13 Stasiun LRT Masjid JamekStasiun LRTRute Sentul Timur-Ampang, Rute Sentul Timur-Sri Petaling dan Rute Terminal PUTRA-Kelana JayaPemandangan pintu masuk stasiun Masjid Jamek Laluan Kelana JayaLokasiJalan Tun Perak, Pusat Bandaraya, Kuala Lumpur, Malaysia.Koordinat3°8′58″N 101°41′46″E / 3.14944°N 101.69611°E / 3.14944; 101.69611PemilikSyarikat Prasarana Negara dan dikendalikan oleh RapidKLJalurRute Sentul Timur-Ampang…

North Korean mass organization Socialist Women's Union of KoreaThe emblem of the Socialist Women's Union of Korea shows the symbol of the Workers' Party of Korea above Mount Paekdu and Kimilsungia flowers.FlagPredecessorNorth Korea Women's LeagueFormation18 November 1945; 78 years ago (1945-11-18)TypeMass organizationPurposeWomen's rightsHeadquartersChungsŏng-dong, Central District, Pyongyang[1]Region North KoreaMembership (2018 est.) 200,000–250,000ChairpersonJang C…

This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Shades J. J. Cale album – news · newspapers · books · scholar · JSTOR (September 2023) (Learn how and when to remove this message) 1981 studio album by J. J. CaleShadesStudio album by J. J. CaleReleasedFebruary 1981Recorded1980StudioCapitol Studios, H…

Kazoh Kitamori (北森 嘉蔵code: ja is deprecated , Kitamori Kazō) adalah salah satu teolog, penulis dan tokoh Jepang pada abad 20 atau pasca Perang Dunia II.[1] Di mana terjadi penghancuran besar Hiroshima (広島市code: ja is deprecated , Hiroshima-shi) dan Nagasaki (長崎市code: ja is deprecated , Nagasaki-shi) termasuk kekalahan Jepang atas tentara Amerika.[2][3] Peristiwa tersebut mengakibatkan penderitaan bagi rakyat Jepang.[4] Melalui peristiwa terseb…

This article is missing information about the film's production, and theatrical release. Please expand the article to include this information. Further details may exist on the talk page. (June 2018) 1982 Canadian filmHumongousU.S. theatrical release posterDirected byPaul LynchWritten byWilliam GrayProduced byAnthony KramreitherStarring Janet Julian David Wallace John Wildman Page Fletcher CinematographyBrian R.R. HebbEdited byNick RotundoMusic byJohn Mills-CockellProductioncompanyHumongous Film…

Lookbook.nuURLLookbook.nuTipeFashion blog, foto blogBahasaInggrisPembuatYuri LeeBerdiri sejak2008Statusaktif Lookbook.nu adalah sebuah Situs komunitas penyuka fesyen yang memungkinkan penggunanya untuk saling berbagi foto dan memberikan deskripsi terhadap foto tersebut.[1] Adapun gaya penampilan yang biasa dianut para penggunanya adalah street style. Street style merupakan gaya berbusana trendi yang menampilkan kepribadian Individu, walaupun terkadang Gaya ini dapat dilihat sebagai sesua…

本條目存在以下問題,請協助改善本條目或在討論頁針對議題發表看法。 此條目已列出參考資料,但文內引註不足,部分內容的來源仍然不明。 (2023年3月13日)请加上合适的文內引註加以改善。 此條目或其章節极大或完全地依赖于某个单一的来源。 (2023年3月13日)请协助補充多方面可靠来源以改善这篇条目。致使用者:请搜索一下条目的标题(来源搜索:國立嘉義高級工業職業…

European Bronze Age culture This article's lead section may be too short to adequately summarize the key points. Please consider expanding the lead to provide an accessible overview of all important aspects of the article. (April 2024) Corded Ware cultureGeographical rangeEuropePeriodChalcolithicDatesc. 3000 BC – c. 2350 BCMajor sitesBronocicePreceded byYamnaya culture, Cucuteni-Trypillia culture, Globular Amphora culture, Funnelbeaker culture, Baden culture, Horgen culture, V…

Former NASA program Logo used for the COTS program Commercial Orbital Transportation Services (COTS) was a NASA program to coordinate the development of vehicles for the delivery of crew and cargo to the International Space Station by private companies. The program was announced on January 18, 2006[1] and successfully flew all cargo demonstration flights by September 2013, when the program ended. NASA's Final Report on the Commercial Orbital Transportation Services program considers it a…

Species of marsupial Stripe-faced dunnart Conservation status Least Concern  (IUCN 3.1)[1] Scientific classification Domain: Eukaryota Kingdom: Animalia Phylum: Chordata Class: Mammalia Infraclass: Marsupialia Order: Dasyuromorphia Family: Dasyuridae Genus: Sminthopsis Species: S. macroura Binomial name Sminthopsis macroura(Gould, 1845) Stripe-faced dunnart range Sminthopsis macroura The striped-faced dunnart (Sminthopsis macroura) is a small, Australian, nocturnal, marsupial m…

Questa voce sull'argomento sistematica organica è solo un abbozzo. Contribuisci a migliorarla secondo le convenzioni di Wikipedia. Struttura del gruppo acetile. In chimica organica, l'acetile (spesso è abbreviato come Ac) è un gruppo funzionale composto dalla parte acilica dell'acido acetico (-COCH3). Ruolo biologico In natura è spesso associato a macromolecole come il coenzima A oppure ad enzimi adibiti al suo metabolismo come il complesso della piruvato deidrogenasi. L'acetile riv…

Tyne and Wear Metro station in North Tyneside Meadow WellTyne and Wear Metro stationGeneral informationLocationMeadow Well, North TynesideEnglandCoordinates55°00′06″N 1°27′56″W / 55.0015620°N 1.4656759°W / 55.0015620; -1.4656759Grid referenceNZ342675Transit authorityTyne and Wear PTEPlatforms2Tracks2ConstructionBicycle facilities2 cycle podsAccessibleStep-free access to platformOther informationStation code MWL (1994–) SPK (1982–1994) Fare zoneB and CHisto…