Operating System Long Questions and AnswersHere in this section of Operating System Long Questions and Answers,We have listed out some of the important Long Questions with Answers on Page fault handling which will help students to answer it correctly in their University Written Exam.

Lists of Long Descriptive type Questions that may be asked in Written Exams.

  • (1) What is page fault handling? How OS handles page fault handling?

Question-1 What is page fault handling? How OS handles page fault handling?
The sequence of events is as follows:

  1. The hardware traps to the kernel, saving the program counter on the stack.
  2. An assembly code routine is started to save the general registers and other volatile information, to keep the operating system from destroying it.
  3. The operating system discovers that a page fault has occurred, and tries to discover which virtual page is needed. Often one of the hardware registers contains this information. If not, the operating system must retrieve the program counter, fetch

the instruction, and parse it in software to figure out what it was doing when the fault hit.

  1. Once the virtual address that caused the fault is known, the system checks to see if this address is valid and the protection consistent with the access. If not, the process is sent a signal or killed. If the address is valid and no protection fault has occurred, the system checks to see if a page frame is free. It no frames are free, the page replacement algorithm is run to select a victim.
  2. If the page frame selected is dirty, the page is scheduled for transfer to the disk, and a context switch takes place, suspending the faulting process and letting another one run until the disk transfer has completed. In any event, the frame is

marked as busy to prevent it from being used for another purpose.

  1. As soon as the page frame is clean (either immediately or after it is written to disk), the operating system looks up the disk address where the needed page is, and schedules a disk operation to bring it in. While the page is being loaded, the

faulting process is still suspended and another user process is run, if one is available.

  1. When the disk interrupt indicates that the page has arrived, the page tables are updated to reflect its position, and the frame is marked as being in normal state.
  2. The faulting instruction is backed up to the state it had when it began and the program counter is reset to point to that instruction.
  3. The faulting process is scheduled, and the operating system returns to the assembly language routine that called it.
  4. This routine reloads the registers and other state information and returns to user space to continue execution, as if no fault had occurred.
Share with : Share on Linkedin Share on Twitter Share on WhatsApp Share on Facebook