Page Faults (7+8) Flashcards
Page fault
when page for given process (to be mapped) to phys address but the given page is not currently loaded into a physical space.
Process page virtual address may be accessible to the process in the virtual address space but the memory page/mapping for this page has not yet been added to the process page tables
Thus page still needs to loaded from secondary storage
What detects page faults and what handles the exceptions
MMU - detects
OS-kernel level applications do error handling
What happens when the OS handles a page fault
OS tries to make page accessible by mapping to phys mem otherwise, if required page cannot be accessed - process is terminated and illegal mem error is thrown
what is a trap (OS context)
exception or fault where OS temporarily switches to kernel mode, performs fault handling action before returning control back to originating process
Examples of OS traps
break points, division by zero, invalid memory access
Steps that OS takes to handle a page fault
- When MMU references a page table - either page is already in phys mem (accessed via temp mem cache used by page table to access frequent pages) or not in mem e.g. MMU tried to do mapping but there is no accessible page - OS elicits a trap
- Trap
- if trap - missing page pulled from secondary storage and mapped
- loaded into main mem address
Once loaded OS exits kernel control (released from trap) and process continues
Three different page faults - name them
compulsory
capacity
policy
compulsory faults
most common
required pages not paged into mem
To avoid this - pre-fetching
what is pre fetching
frequently used pages are loaded int cache memory
capacity faults
page is scheduled but main mem is full of other pages. Another page must be swapped out
policy faults
page prematurely swapped out because of replacement algorithm
Pages that are high priority should be swapped into main mem before low priority pages? T/F
True
What does the scheduling of page resources
page replacement policy
what are the 3 core implementations in the MMU that page fault handling makes use of
mapping, page tables. page replacement policy
What kind of mem mapping does MMU use?
Assume that the MMU uses fully associative memory mapping