What is Page fault and when does page fault error occur in Operating System?

Asked 04-Apr-2022
Viewed 243 times

0

What is Page fault and when does page fault error occur in Operating System?


1 Answer


0

  • When a software tries to access data or code that is in its address space but not already in the system RAM, a page fault occurs. When there is a page fault, the following sequence of events occurs:
  • The programme counter (PC) is saved on the stack after the computer hardware traps to the kernel. Information about the current state of an instruction is recorded in CPU registers.
  • To prevent the OS from deleting the general registers and other volatile information, an assembly programme is started.
  • Once the virtual address that produced the page fault is identified, the system checks to determine if the address is genuine and if there is no problem with protected access.
  • If the virtual address is correct, the system looks for a free page frame. The page replacement algorithm is used to remove a page if no frames are available.
  • If the specified frame is dirty, the page is scheduled for disc transfer, a context switch occurs, the fault process is suspended, and another process is started until the disc transfer is completed.


Read More: What are the advantages of multithreaded programming in Operating System?