Page Fault in OS
If you want to know about page fault in OS then you must be study about Virtual Memory then you can read this article. Virtual Memory in Operating System
Definition: Page fault dominates like an error. If any program tries to access piece of memory but which didn’t existed into physical memory, means main memory, then page fault will occur. The fault specifies the O/S that it must trace the all data in to virtual memory management, and after that moves it from secondary memory like as hard disk to primary memory of system.
Page Fault in OS Diagram
In the programming methods, page fault arise the exception, that specifies the O/S, which access the memory slots from virtual memory for running the program in continue nature.
Page Fault Handling
- All hardware components of computer monitor program counter and kernel that save in the stack, and CPU registers have to store all current running state information.
- Assembly programs help to store general registers as well as volatile information.
- Page fault is searched by the operating system, and trace the virtual pages which are needed.
- Hardware registers also consist the all those needed information.
But, if required page didn’t load in to memory, then page fault trap arises.
Now these steps must following for handling the page fault.
- Firstly, get check to main memory address requests; ensure those requests must be valid.
- If reference got invalid then the process will terminate, otherwise the page is going to paged in.
- Then, Free-frame list locates the free frame.
- Now disk operation will schedule to fetch the needed page from disk.
- When I/O operation done, and new frame number will be adding in the process’s page table, and invalid bit get alter. Now this is valid page reference.
- If, further any page fault will find then recycle these instructions from starting.
Page Fault in OS ‘Terminology’
Page Hit – If CPU tries to retrieve the needed page from main memory, and that page is existed in the main memory (RAM), then it is known as “PAGE HIT”.
Page Miss – If required page did not exist in the RAM then it is known as “PAGE MISS”.
Page Fault Rate – That rate, on which threads find the page fault in the memory, it is known as “PAGE FAULT RATE”. Page Fault Rate is measured in Per Second.
Page Fault Time – Time taken to fetch page from secondary memory + time taken to retrieve from RAM after loading the needed page, and that taken combine time is known as “PAGE FAULT TIME”.
Hard Page Fault – If needed page is existed in the page file in the hard disk, then it is known as “HARD PAGE FAULT”.
Soft Page Fault – If need page is not presented in hard disk but it found somewhere else in memory, and then it is known as “SOFT PAGE FAULT”.
Minor Page Fault – If process requires any data, and that data existed in memory but the same time it allotted to another process, then it is known as “MINOR PAGE FAULT”.