OS & Hardware

When does a page fault occur?

  1. AWhen data is not in the cache and is fetched from main memory
  2. BWhen the accessed page is not mapped to physical memory
  3. CWhen the TLB holds the translation and the physical address is found immediately
Show answer and explanation

Answer: B. When the accessed page is not mapped to physical memory

A page fault is an exception raised when the accessed page's page-table entry is invalid, meaning it is not mapped to physical memory (it was paged out or never loaded), or when the access is not permitted, such as writing a read-only page. The OS supplies the page and retries the instruction. A cache miss is handled entirely in hardware and is not an exception. If the TLB has the translation, it completes at once and no fault occurs.

  • A. Cache misses are handled in hardware and raise no exception.
  • B. Correct. It is the exception raised when the page is not in physical memory.
  • C. With a TLB hit translation completes at once, so no fault occurs.
Practice this topic Back to topic

More OS & Hardware questions

  1. When a page fault occurs on a page that was evicted to disk, what does the OS do?
  2. What is the main reason for using multilevel (hierarchical) page tables instead of a single level?
  3. With 32-bit virtual addresses, 4 KB pages and 4-byte page-table entries, how large is a single-level page table?
  4. 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?
  5. Which combination of information does a page-table entry usually contain?