Share to: share facebook share twitter share wa share telegram print page

Page fault

In computing, a page fault is an exception that the memory management unit (MMU) raises when a process accesses a memory page without proper preparations. Accessing the page requires a mapping to be added to the process's virtual address space. Furthermore, the actual page contents may need to be loaded from a back-up, e.g. a disk. The MMU detects the page fault, but the operating system's kernel handles the exception by making the required page accessible in the physical memory or denying an illegal memory access.

Valid page faults are common and necessary to increase the amount of memory available to programs in any operating system that uses virtual memory, such as Windows, macOS, and the Linux kernel.[1]

Types

Minor

If the page is loaded in memory at the time the fault is generated, but is not marked in the memory management unit as being loaded in memory, then it is called a minor or soft page fault. The page fault handler in the operating system merely needs to make the entry for that page in the memory management unit point to the page in memory and indicate that the page is loaded in memory; it does not need to read the page into memory. This could happen if the memory is shared by different programs and the page is already brought into memory for other programs.

The page could also have been removed from the working set of a process, but not yet written to disk or erased, such as in operating systems that use Secondary Page Caching. For example, OpenVMS may remove a page that does not need to be written to disk (if it has remained unchanged since it was last read from disk, for example) and place it on a Free Page List if the working set is deemed too large. However, the page contents are not overwritten until the page is assigned elsewhere, meaning it is still available if it is referenced by the original process before being allocated. Since these faults do not involve disk latency, they are faster and less expensive than major page faults.

Major

This is the mechanism used by an operating system to increase the amount of program memory available on demand. The operating system delays loading parts of the program from disk until the program attempts to use it and the page fault is generated. If the page is not loaded in memory at the time of the fault, then it is called a major or hard page fault. The page fault handler in the OS needs to find a free location: either a free page in memory, or a non-free page in memory. This latter might be used by another process, in which case the OS needs to write out the data in that page (if it has not been written out since it was last modified) and mark that page as not being loaded in memory in its process page table. Once the space has been made available, the OS can read the data for the new page into memory, add an entry to its location in the memory management unit, and indicate that the page is loaded. Thus major faults are more expensive than minor faults and add storage access latency to the interrupted program's execution.

Invalid

If a page fault occurs for a reference to an address that is not part of the virtual address space, meaning there cannot be a page in memory corresponding to it, then it is called an invalid page fault. The page fault handler in the operating system will then generally pass a segmentation fault to the offending process, indicating that the access was invalid; this usually results in abnormal termination of the code that made the invalid reference. A null pointer is usually represented as a pointer to address 0 in the address space; many operating systems set up the MMU to indicate that the page that contains that address is not in memory, and do not include that page in the virtual address space, so that attempts to read or write the memory referenced by a null pointer get an invalid page fault.

Invalid conditions

Illegal accesses and invalid page faults can result in a segmentation fault or bus error, resulting in an app or OS crash. Software bugs are often the causes of these problems, but hardware memory errors, such as those caused by overclocking, may corrupt pointers and cause valid code to fail.

Operating systems provide differing mechanisms for reporting page fault errors. Microsoft Windows uses structured exception handling to report invalid page faults as access violation exceptions. UNIX-like systems typically use signals, such as SIGSEGV, to report these error conditions to programs. If the program receiving the error does not handle it, the operating system performs a default action, typically involving the termination of the running process that caused the error condition, and notifying the user that the program has malfunctioned. Windows often reports such crashes without going to any details. An experienced user can retrieve detailed information using WinDbg and the minidump that Windows creates during the crash. UNIX-like operating systems report these conditions with such error messages as "segmentation violation" or "bus error", and may produce a core dump.

Performance impact

Page faults degrade system performance and can cause thrashing. Major page faults on conventional computers using hard disk drives can have a significant impact on their performance, as an average hard disk drive has an average rotational latency of 3 ms, a seek time of 5 ms, and a transfer time of 0.05 ms/page. Therefore, the total time for paging is near 8 ms (= 8,000 μs). If the memory access time is 0.2 μs, then the page fault would make the operation about 40,000 times slower.

Performance optimization of programs or operating systems often involves reducing the number of page faults. Two primary focuses of the optimization are reducing overall memory usage and improving memory locality. To reduce the page faults, developers must use an appropriate page replacement algorithm that maximizes the page hits. Many have been proposed, such as implementing heuristic algorithms to reduce the incidence of page faults.

A larger physical memory also reduces page faults.

See also

Notes

References

  1. ^ Bovet, Daniel; Cesati, Marco (November 2005). Understanding the Linux Kernel (PDF) (3rd ed.). O'Reilly Media. ISBN 0-596-00565-2. Retrieved 9 October 2021.
  • John L. Hennessy, David A. Patterson, Computer Architecture, A Quantitative Approach (ISBN 1-55860-724-2)
  • Tanenbaum, Andrew S. Operating Systems: Design and Implementation (Second Edition). New Jersey: Prentice-Hall 1997.
  • Intel Architecture Software Developer's Manual–Volume 3: System Programming

Read other articles:

Adrien Proust Información personalNacimiento 18 de marzo de 1834 Illiers-Combray (Francia) Fallecimiento 26 de noviembre de 1903 (69 años)París (Francia) Sepultura Cementerio del Père-Lachaise y Marcel Proust's tomb Nacionalidad FrancesaFamiliaCónyuge Jeanne-Clémence Proust Hijos Marcel ProustRobert Proust EducaciónEducado en Universidad de París Información profesionalOcupación Médico, profesor universitario y patólogo Empleador Universidad de París Miembro de Académie National...

Bitstream Inc.TypePublic (Nasdaq: BITS)IndustryType foundry, mobile phone web browsersFounded1981FounderMatthew CarterMike Parker DefunctMarch 19, 2012 (2012-03-19)FateAcquired by MonotypeHeadquartersMarlborough, Massachusetts, United StatesKey peopleAmos Kaminski, Chairman and Interim CEONumber of employees96[1]Websitewww.bitstream.com Bitstream Inc. was a type foundry that produced digital typefaces. It was founded in 1981 by Matthew Carter and Mike Parker a...

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (أبريل 2019) جورجيا لي معلومات شخصية الميلاد سنة 1921  كيرنز، كوينزلاند  الوفاة 23 أبريل 2010 (88–89 سنة)[1]  كيرنز، كوينزلاند  مواطنة أستراليا  الحياة العملية...

  Stenocereus beneckei Estado de conservaciónCasi amenazado (UICN)[1]​TaxonomíaReino: PlantaeSubreino: TracheobiontaDivisión: MagnoliophytaClase: MagnoliopsidaSubclase: CaryophyllidaeOrden: CaryophyllalesFamilia: CactaceaeSubfamilia: CactoideaeTribu: PachycereeaeGénero: StenocereusEspecie: S. beneckei(Ehrenb.) A.Berger & Buxb.[editar datos en Wikidata] Stenocereus beneckei es una especie de planta fanerógama de la familia Cactaceae. Es endémica de México donde ...

SantozArdaninggar NazirLahirArdaninggar Nazir17 April 1982 (umur 41)Jakarta, IndonesiaNama lainSantozPekerjaanRapperpenulis laguproduser musikKarier musikGenrehip hopTahun aktif1999 - sekarangLabelSony Music Entertainment IndonesiaArtis terkaitFade2BlackBondan Prakoso & Fade 2 BlackAnggotaFade2Black Ardaninggar Nazir atau dikenal sebagai Santoz (lahir 17 April 1982) merupakan seorang musisi berkebangsaan Indonesia yang juga merupakan penulis lirik dari grup musik Bondan Prakoso ...

13-й чемпіонат світу ФІНА Країна-господар Рим (Італія)Дата проведення 18 липня - 2 серпня 2009Місце проведення Італійський форум[ru]Країни-учасниці 185Спортсмени 2556Відкриття Джорджо Наполітано← Мельбурн 2007 Шанхай 2011 → Чемпіонат світу ФІНА 2009Стрибки у водуІндивідуальні1 мч

Рубанчиков Сергій Петрович  Солдат Загальна інформаціяНародження 7 березня 1980(1980-03-07)Київ, УРСРСмерть 22 грудня 2016(2016-12-22) (36 років)Світлодарськ, Донецька область, УкраїнаПоховання Лук'янівське військове кладовищеПсевдо «Відьмак»/«Добрий»Військова службаРоки служби 201...

Railway station in Toyama, Toyama Prefecture, Japan Toyama Station富山駅The south side of Toyama Station in December 2016General informationLocation1-227 Meirinchō, Toyama-shiToyama PrefectureJapanOperated by JR West Ainokaze Toyama Railway Toyama Chihō Railway Line(s) Hokuriku Shinkansen Takayama Main Line Ainokaze Toyama Railway Line Toyama Chiho Railway Fujikoshi Line, Main Line, Tateyama Line (3 lines at Dentetsu-Toyama) Toyamakō Line (Toyama-Ekimae Toyamaeki-Kita) HistoryOpened20&#...

Theater in Houston, Texas 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: Hobby Center for the Performing Arts – news · newspapers · books · scholar · JSTOR (March 2010) (Learn how and when to remove this template message) Hobby Center for the Performing ArtsAddress800 Bagby StreetHouston, TexasUnited States...

مرصد أباتشي بوينت مباني تلسكوب ARCSAT ومقراب مسح سلووان الرقمي للسماء في مرصد أباتشي بوينت. إحداثيات 32°46′49″N 105°49′13″W / 32.78028°N 105.82028°W / 32.78028; -105.82028 معلومات عامة الدولة الولايات المتحدة  تاريخ الافتتاح الرسمي 1998  التأسيس 1985 المنظمة اتحاد بحوث الفيزياء الفلكي...

World War II mass shooting of Jews You can help expand this article with text translated from the corresponding article in German. (December 2021) Click [show] for important translation instructions. Machine translation, like DeepL or Google Translate, is a useful starting point for translations, but translators must revise errors as necessary and confirm that the translation is accurate, rather than simply copy-pasting machine-translated text into the English Wikipedia. Consider adding ...

Queen consort of Libya 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: Fatimah el-Sharif – news · newspapers · books · scholar · JSTOR (December 2023) (Learn how and when to remove this template message) Fatimah as-SenussiQueen Fatima in the 1950sQueen consort of LibyaTenure24 December 1951 – 1 September 1...

Eleições nos Estados Unidos em 2020 geral Dia de votação 3 de novembro Eleição presidencial Mapa do Colégio Eleitoral Joe Biden (DEM) 306 Donald Trump (GOP) 232 Eleição para a Câmara dos Representantes Deputados eleitos 222 democratas211 republicanos Maioria Partido Democrata      Incumbente democrata      Incumbente republicano      Vago      Democrata que não é candidato à reelei...

Highway in Nevada Las Vegas BeltwayBruce Woodbury BeltwayInterstate 215 in red, Clark County 215 in blueRoute informationAuxiliary route of I-15Maintained by NDOT and Clark County Public WorksLength50 mi[1] (80 km)I-215: 12.8 miles (20.6 km)[2]CC 215: 37.2 miles (59.9 km)ExistedApril 17, 1993–presentComponenthighways I-215 from Henderson to Enterprise CC 215 from Enterprise to North Las VegasNHSEntire routeMajor junctionsBeltway around Las Vegas...

1999 novel by Ralph Ellison Juneteenth AuthorRalph EllisonCountryUnited StatesLanguageEnglishGenreAfrican-American literaturePublisherRandom HousePublication date1999Media typePrint (Hardcover and Paperback)Pages368ISBN0-394-46457-5 Juneteenth (1999) is the second novel by American writer Ralph Ellison. It was published posthumously, compiled as a 368-page condensation of material from more than 2,000 pages written by him over a period of 40 years.[1] He had never completed a man...

НХЛ в сезоне 2021/2022 Начало 12 октября 2021 Конец 26 июня 2022 Регулярный чемпионат Президентский кубок (очков) Флорида Пантерз (122) Лучший бомбардир (очков) Коннор Макдэвид (123) Лучший снайпер (голов) Остон Мэттьюс (60) MVP Сезона Остон Мэттьюс Количество игр 1312 Количество команд 32 Пле...

1996 Spanish horror film by Alejandro Amenábar For other uses of Thesis, see Thesis (disambiguation). ThesisPosterSpanishTesis Directed byAlejandro AmenábarScreenplay byAlejandro AmenábarStory byAlejandro AmenábarMateo GilProduced byEmiliano OteguiJosé Luis CuerdaStarringAna TorrentFele MartínezEduardo NoriegaMiguel PicazoJavier ElorriagaCinematographyHans BurmannEdited byMaría Elena Sáinz de RozasMusic byAlejandro AmenábarProductioncompaniesLas Producciones del EscorpiónSogepaqDist...

1521 collection of Wessel Gansfort's works This article relies largely or entirely on a single source. Relevant discussion may be found on the talk page. Please help improve this article by introducing citations to additional sources.Find sources: Sum of Christianity – news · newspapers · books · scholar · JSTOR (March 2015) The Sum of Christianity or Farrago Rerum Theologicarum, is a collection of Wessel Gansfort's writings published at Zwolle, probab...

Education movement This article contains content that is written like an advertisement. Please help improve it by removing promotional content and inappropriate external links, and by adding encyclopedic content written from a neutral point of view. (November 2018) (Learn how and when to remove this template message) UWC (United World Colleges)TypeSchools, colleges, and short educational programmesEstablished1962; 61 years ago (1962)FounderKurt HahnPresidentQueen Noor of Jor...

Sovremenny-class destroyer of the Soviet Navy For other ships with the same name, see Soviet destroyer Boyevoy (1950). Boyevoy underway in 1987 History Soviet Union → Russia Name Boyevoy (Боевой) NamesakeMilitant in Russian BuilderZhdanov Shipyard, Leningrad Laid down26 March 1982 Launched4 August 1984 Commissioned5 November 1986 Decommissioned1998 HomeportVladivostok IdentificationPennant number: 554, 640, 678, 720, 728, 770 StatusUndergoing scrap[when?] General characteristi...

Kembali kehalaman sebelumnya