Page table entry contains valid/invalid bit that indicates whether corresponding page is currently in memory or not. If the valid/invalid bit = 1 that means page is not available in the memory and a page fault to be occurred. The control is trapped to the operating system.

Page Replacement

When a page fault occur in the memory that means operating system brings that page into the memory and the following procedure is applied:

(i) Trap the operating system and save registers, process state for current process.

(ii) Check if page replacement is legal and if yes then determine the location of that page on disk.

(iii) Search a free frame and read that required page from the disk into free frame.

(iv) When execution is completed then restore registers and process state of previous process and modify page table entry.

(v) Resume execution.

Checking address, searching a free frame, context switch, resume of process are fast activities. Other activities like swapping are slow. To reduce overhead of page transfers, we uses modify or dirty bit.