A Page Fault Can Be Part of Normal Execution

A page fault transfers control to the operating system because the memory access needs handling under current mappings or permissions.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace a deferred page
  2. Use context when measuring
  3. Trace a valid access that needs a mapping established
  4. Distinguish latency from invalid access

Trace a deferred page

A valid allocated page can be supplied on its first access, after which the instruction can continue. Another access can fail because its address is outside permitted mappings. Demand paging explains how normal faults can load data.

Use context when measuring

A count of page faults alone does not establish a program bug. Look at their types and the observed resource cost. Page ranges and offsets supply the mapping unit involved.[1]

Trace a valid access that needs a mapping established

A process touches a valid memory-mapped file region for the first time. If the required page is not currently mapped, the operating system can handle a page fault by obtaining or mapping the page and resume the access. See memory mapping and file reads.

Reference to valid but missing page → fault handler establishes mapping → retry can succeed
Reference to forbidden region → outcome may be an access error instead

Distinguish latency from invalid access

A handled fault can be ordinary on demand-paged systems. It may be quick if data is already in memory or require storage work. Record what happened before classifying a fault as a program defect.

References

  1. Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau, Operating Systems: Three Easy Pieces ↩