Minor page fault 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.
Major page fault 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 later 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 page fault 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 ==