Page fault is also known as the pf
or #pf and can be thought of as a trap that the hardware raises for the
software whenever the program tries to access a page that has been mapped to an
address space in the virtual memory but has not been loaded in the main memory.
In most cases, the page fault is handled by the operating system by
helping in accessing the required page at an address space in the main or the
physical memory or sometimes by terminating the program if it makes an illegal
attempt to the access the page.
- Memory management unit is the hardware that is
responsible for detecting the page faults and is located in the processor.
- The
software that helps the memory management unit in handling the page faults is
the exception handling software and is seen as a part of the OS.
- ‘Page fault’ is not always an error.
- These are often seen as a
necessary role player in increasing the memory.
- This can be made available to
the software applications that makes use of the virtual memory of the operating system for execution.
- Hard fault is the term used by the
Microsoft instead of page fault in the resource monitor’s latest versions.
Classification of Page Faults
Page
faults can be classified in to three categories namely:
1. Minor:
- This type of
fault is also called the soft page fault and is said to occur when the
loading of the page in to the memory takes place at the time of the fault
generation, but the memory management unit does not mark it as being
loaded in the physical memory.
- A page fault handler is included in the
operating system whose duty is to make an entry for the page that is
pointed to by the memory management unit.
- After making the entry for it,
its task is to give an indication that the page has been loaded.
- However, it is not necessary that the page must be read in to the memory.
- This is
possible if the different programs share the memory and the page has been
loaded in to the memory for the various applications.
- In the operating
systems that apply the technique of secondary page caching, the page can
be removed from the working set of the process but not deleted or written
to the disk.
2. Major:
- Major fault is actually
a fault that many operating systems use for increasing the memory for the
program that must be available as demanded by the program.
- The loading of
the parts of the program is delayed by the operating system from the disk
until an attempt is made by the program for using it and generating the
page fault.
- In
this case either a non – free page or a page in the memory has to be found
by the page fault handler.
- When the page is available, the data from it
can be read by the operating system to the new page in the main memory,
thus easily making an entry for the required page.
3. Invalid:
- This type
of fault occurs whenever a reference is made to an address that does not
exists in the virtual address space and therefore it has no page
corresponding to it in the memory.
- Then the code by which the reference
was made has to be terminated by the page fault handler and give an
indication regarding the invalid reference.
No comments:
Post a Comment