Overview
A page fault is not necessarily an error. It is the mechanism the OS uses to implement demand paging. When a fault occurs, the CPU traps to the OS, which then loads the required page from disk into RAM and updates the page table.
Types
- Soft Page Fault: The page is in RAM but not mapped in the process's page table (fast to fix).
- Hard Page Fault: The page must be read from the disk (very slow).
- Invalid Page Fault: The program tried to access memory it doesn't own (results in a 'Segmentation Fault' or 'Access Violation').