OS & Hardware
When a page fault occurs on a page that was evicted to disk, what does the OS do?
- AIt immediately terminates the program abnormally without loading the page
- BAfter loading the page, it skips the faulting instruction and resumes at the next one
- CIt loads the page from disk, updates the table and retries the instruction
Show answer and explanation
Answer: C. It loads the page from disk, updates the table and retries the instruction
For a page fault from a legitimate access, the OS finds a free physical page (evicting another if needed), reads the contents from disk and marks the page-table entry valid. It then re-executes the faulting instruction from the start, so the program continues as if nothing happened. Skipping the instruction would leave the access undone and produce wrong results. Abnormal termination is for illegal accesses to unmapped addresses.
- A. Legitimate accesses are not terminated; the page is supplied.
- B. Skipping the instruction leaves the access undone and gives wrong results.
- C. Correct. It supplies the page, updates the table and retries the instruction.