FACTOID # 22: South Dakota has the highest employment ratio in America, but the lowest median earnings of full-time male employees.
 
 Home   Encyclopedia   Statistics   States A-Z   Flags   Maps   FAQ   About 
   
 
WHAT'S NEW
 

SEARCH ALL

FACTS & STATISTICS    Advanced view

Search encyclopedia, statistics and forums:

 

 

(* = Graphable)

 

 


Encyclopedia > Page fault

In computer storage technology, a page is a fixed length block of memory that is used as a unit of transfer between physical memory and external storage like a disk, and a page fault is an interrupt (or exception) to the software raised by the hardware, when a program accesses a page that is mapped in address space, but not loaded in physical memory. This article does not cite any references or sources. ... It has been suggested that this article or section be merged into Paging. ... It has been suggested that this article or section be merged with Primary storage. ... Typical hard drives of the mid-1990s. ... In computing, an interrupt is an asynchronous signal from hardware or software indicating the need for attention. ... Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of some condition that changes the normal flow of execution. ...


The hardware that detects this situation is the memory management unit in a processor. The exception handling software that handles the page fault is generally part of an operating system. The operating system tries to handle the page fault by making the required page accessible at a location in physical memory or kills the program in case it is an illegal access. This 68451 MMU could be used with the Motorola 68010 MMU, short for memory management unit or sometimes called paged memory management unit as PMMU, is a class of computer hardware components responsible for handling memory accesses requested by the CPU. Among the functions of such devices are the translation... Exception handling is a programming language construct or computer hardware mechanism designed to handle the occurrence of some condition that changes the normal flow of execution. ... // An operating system (OS) is the software that manages the sharing of the resources of a computer. ...

Contents

Page faults are not fatal

Contrary to what their name might suggest, page faults are not necessarily fatal and are common and necessary to increase the amount of memory available to programs in any operating system that utilizes virtual memory, including Microsoft Windows, Mac OS X and Linux. How virtual memory maps to physical memory Virtual memory is an addressing scheme implemented in hardware and software that allows non-contiguous memory to be addressed as if it were contiguous. ... Windows redirects here. ... Mac OS X (IPA: ) is a line of graphical operating systems developed, marketed, and sold by Apple Inc. ... This article is about operating systems that use the Linux kernel. ...


Reasons for page fault

Hardware generates a page fault for page accesses where:

  • the page corresponding to the requested address is not loaded in memory.
  • the page corresponding to the memory address accessed is loaded, but its present status is not updated in hardware.

The closely related exception known as the protection fault is generated for page accesses where:

  • the page is not part of the program, and so is not mapped in program memory.
  • the program does not have sufficient privileges to read or write the page.
  • the page access is legal, but it is mapped with demand paging.

Protection fault can also be generated for many other invalid accesses not related to paging. In computer operating systems, demand paging is an application of virtual memory. ...


On the x86 architecture, accesses to pages that are not present and accesses to pages that do not conform to the permission attributes for a given page (protection faults as described above) are both reported via the page fault processor exception. Internally, the processor hardware provides information to the page fault handler that indicates what sort of access triggered the fault, so that these scenarios may be differentiated from the perspective of the operating system. The usage of the term protection fault (when speaking in relation to page faults) is thus not to be confused with the general protection fault exception, which is used to signal segmentation-based memory access violations, as well as a variety of other general protection related violations (such as the use of an instruction that is not valid at the current privilege level). x86 or 80x86 is the generic name of a microprocessor architecture first developed and manufactured by Intel. ... // An operating system (OS) is the software that manages the sharing of the resources of a computer. ... A General Protection Fault (GPF) in the Intel x86 and AMD x86-64 architectures is a fault (a type of an interrupt) which can encompass several cases, where protection mechanisms within the processor architecture are violated by any of the programs that is running, whether it be the kernel or... Segmentation is one of the most common ways to achieve memory protection; another common one is paging. ... The concept of privilege level refers to protecting resources on a CPU. Different execution threads can have different privilege levels that grant access to resources such as memory regions, I/O ports, and special instructions. ...

Page Mapped Page Loaded Page Status Page access valid Exception
yes yes present yes No exception
yes -- not present yes Page fault
no -- -- -- Protection fault
-- -- -- no Protection fault

Minor page fault

If the page is loaded in memory at the time the fault is generated, but its status is not updated as 'present' in hardware, then it is called a minor or soft page fault. This could happen if the memory is shared by different programs and the page is already brought into memory for other programs. Since these faults do not involve disk latency, they are faster and less expensive than major page faults. // Diagram of a typical Shared memory system. ...


Major page fault

If the page is not loaded in memory at the time the fault is generated, then it is called a major or hard page fault. Major faults are more expensive than minor page faults and add disk latency to the interrupted program's execution. 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.


Invalid page fault

If a page fault occurs that attempts to read the memory referenced by a null pointer, the system may alternatively generate an invalid page fault. The operating system maps a dummy page for catching null pointers.


Protection fault

When a program attempts invalid page accesses, for example trying to access pages not mapped into its memory, tries to write to read-only pages, or tries to modify privileged pages, the system hardware will generate a protection fault. Not all protection faults are illegal accesses, and they are the mechanism used by an operating system to implement copy on write access to share the same copy of memory among many programs until one of the programs wants to modify its copy. Copy-on-write (sometimes referred to as COW) is an optimization strategy used in computer programming. ...


A program trying to access memory that belongs to another process is attempting 'illegal access' which generates a protection fault. The operating system handles this protection fault much like an invalid page fault: The operating system temporarily blocks 'write permission' until a page fault is generated, then creates new access information to allow the program to successfully find this memory.


Note that in terms of the x86 architecture, memory protection violations reported via the page fault mechanism (protection faults, as described in this article) are distinct from memory protection violations reported via the general protection fault mechanism. The general protection fault mechanism is used to report segmentation-based memory access violations as well as other classes of protection violations. The page fault mechanism is used to report paging-based memory protection violations. x86 or 80x86 is the generic name of a microprocessor architecture first developed and manufactured by Intel. ... A General Protection Fault (GPF) in the Intel x86 and AMD x86-64 architectures is a fault (a type of an interrupt) which can encompass several cases, where protection mechanisms within the processor architecture are violated by any of the programs that is running, whether it be the kernel or... Look up segmentation in Wiktionary, the free dictionary. ...


Handling illegal accesses and invalid page faults

Illegal accesses and invalid page faults can result in a program crash, segmentation error, bus error or core dump depending on the semantics of the operating system environment. Frequently these problems are the manifestation of software bugs, but the hardware memory errors frequently caused by overclocking may corrupt pointers causing even correct software to fail. A core dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally (crashed). ... AMD Athlon XP Overclocking BIOS Setup on ABIT NF7-S. FSB frequency (External clock) has increased from 133 MHz to 148 MHz, and clock multiplier factor has changed from 13. ...


Operating systems such as Windows and UNIX (and other UNIX-like systems) provide differing mechanisms for reporting errors caused by page faults. Windows uses structured exception handling to report page fault-based invalid accesses as access violation exceptions, and UNIX (and UNIX-like) systems typically use signals, such as SIGSEGV, to report these error conditions to programs. 1. ... Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ... Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ... An access violation is the attempt by a computer process to access a memory area that it does not own or have permission to access. ... Please wikify (format) this article as suggested in the Guide to layout and the Manual of Style. ... On POSIX compliant platforms, SIGSEGV is the symbolic name for the signal thrown by computer programs making invalid memory references. ...


If the program that received the error does not handle it, then the operating system typically performs some sort of default action, typically involving the termination of the running process that caused the error condition, and a notification to the user that the program has malfunctioned. In this vein, recent versions of Windows often report such problems with less technical error messages simply stating something along the lines of this program must close" (an experienced user or programmer with access to a debugger can still retrieve detailed information, if necessary). Additionally, recent Windows versions also write a minidump (similar in principle to a core dump) describing the state of the crashed process for later analysis alongside such less-technical error messages. UNIX and UNIX-like operating systems typically report these conditions to the user with error messages such as "segmentation violation", or "bus error". Illustration of a physical process: a geyser in action. Process (lat. ... A programmer or software developer is someone who programs computers, that is, one who writes computer software. ... A debugger is a computer program that is used to test and debug other programs. ... A core dump is the recorded state of the working memory of a computer program at a specific time, generally when the program has terminated abnormally (crashed). ... Filiation of Unix and Unix-like systems Unix (officially trademarked as UNIX®) is a computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. ... Diagram of the relationships between several Unix-like systems A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification. ...


Performance

Page faults, by their very nature, degrade the performance of a program or operating system and in the degenerate case can cause thrashing. Optimizations to programs and the operating system that reduce the number of page faults that occur improve the performance of the program or even the entire system. The two primary focuses of the optimization effort focus on reducing overall memory usage and improving memory locality. Generally, making more physical memory available also reduces page faults. Many page replacement algorithms have been proposed, implementing a heuristic to reduce the incidence of page faults. A computer program is a collection of instructions that describe a task, or set of tasks, to be carried out by a computer. ... In computer science, thrash is the poor performance of a virtual memory (or paging) system, when the same pages are being loaded repeatedly due to a lack of main memory. ... In computing, optimization is the process of modifying a system to make some aspect of it work more efficiently or use fewer resources. ... Memory Locality is a term in computer science used to denote the temporal or spatial proximity of memory access. ... It has been suggested that this article or section be merged into cache algorithms. ... In computer science, besides the common use as rule of thumb (see heuristic), the term heuristic has two well-defined technical meanings. ...


See also

In computer operating systems, demand paging is an application of virtual memory. ...

References

  • 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

External links

  • "So What Is A Page Fault?" from OSR Online (a Windows-specific explanation)
  • "Virtual Memory Details" from the Red Hat website.
  • "UnhandledExceptionFilter (Windows)" from MSDN Online.

  Results from FactBites:
 
Page fault - Wikipedia, the free encyclopedia (414 words)
The software that handles the page fault is generally part of an operating system and the hardware that detects this situation is the memory management unit in processors.
The general protection fault, or the less common "invalid page fault," found on computers running a Microsoft Windows operating system, are actually generated by the exception handling code in the operating system's page fault handler.
Page faults, by their very nature, degrade the performance of a program or operating system and in the degenerate case can cause thrashing.
Linux Page Fault Scalability and Performance (2980 words)
The page fault handler is a critical piece of code in the Linux kernel that has a major influence on the performance of the memory subsystem.
A page fault first acquires a read lock on mmap_sem (which alone would allow other threads to continue processing page faults) and then acquires a spin lock on the page_table_lock (which serializes access to the page table and important data structures) before acquiring a free page from the page allocator.
The page is then cleared by overwriting the contents with zeros (only initialized memory is provided to processes!) and the page is assigned to the process by creating a corresponding page table entry in the page table of the process.
  More results at FactBites »

 
 

COMMENTARY     


Share your thoughts, questions and commentary here
Your name
Your comments

Want to know more?
Search encyclopedia, statistics and forums:

 


Press Releases |  Feeds | Contact
The Wikipedia article included on this page is licensed under the GFDL.
Images may be subject to relevant owners' copyright.
All other elements are (c) copyright NationMaster.com 2003-5. All Rights Reserved.
Usage implies agreement with terms, 1022, m