What is Page Fault in OS (Operating System) | Page Fault Handling in OS

What is Page Fault in OS (Operating System) | Page Fault Handling in OS

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 is not existed into physical memory, means main memory, then page fault will be occurred. 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

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 are saved 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 is not loaded in to memory, then page fault trap is arisen.

Now these steps must be followed for handling the page fault.

  1. Firstly, get check to main memory address requests; ensure those requests must be valid.
  1. If reference got invalid then the process will be terminated, otherwise the page is going to paged in.
  1. Then, Free-frame list locates the free frame.
  1. Now disk operation will be scheduled to fetch the needed page from disk.
  1. When I/O operation is done, and new frame number will be added in the process’s page table, and invalid bit is altered. Now this is valid page reference.
  1. If, further any page fault will be found 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 is not existed 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 is allotted to another process, then it is known as “MINOR PAGE FAULT”.

Leave a Reply

Your email address will not be published. Required fields are marked *