OS & Hardware

When a page fault occurs on a page that was evicted to disk, what does the OS do?

  1. AIt immediately terminates the program abnormally without loading the page
  2. BAfter loading the page, it skips the faulting instruction and resumes at the next one
  3. 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.
Practice this topic Back to topic

More OS & Hardware questions

  1. What is the main reason for using multilevel (hierarchical) page tables instead of a single level?
  2. With 32-bit virtual addresses, 4 KB pages and 4-byte page-table entries, how large is a single-level page table?
  3. With 48 virtual address bits in use, 4 KB pages and 512-entry (9-bit) tables at each level, how many levels must a multilevel page table walk?
  4. Which combination of information does a page-table entry usually contain?
  5. What is the advantage of using copy-on-write when duplicating a process?