OS & Hardware
When does a page fault occur?
- AWhen data is not in the cache and is fetched from main memory
- BWhen the accessed page is not mapped to physical memory
- 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.