Definition
Page Fault
Handling Mechanism
When a page fault occurs, the operating system must intervene to bring the required page into memory:
- Trap to Kernel: The hardware generates a trap, transferring control to the OS.
- Locate Page: The OS determines the location of the required page on secondary storage (disk).
- Find Free Frame: The OS searches for an available physical frame. If none are free, it must invoke a replacement policy.
- I/O Operation: The page is read from disk into the allocated frame.
- Update Page Table: The process’s page table is updated (setting the present bit to 1).
- Restart Instruction: The CPU restarts the instruction that caused the fault.
Performance Impact
Frequent page faults can lead to thrashing, where the system spends more time performing I/O than executing user code.