1)The modified page table mechanism Page table when some pages are not in main memory 2 valid-invalie3 A frame bit A B 0 4 5 C 6 C D A E 8 4 5 5 8 9 ◇ 6 G 10 回 7 H 11 口 logical memory 12 13 14 15 PhysicalMemory Transfer of a paged memory to contiguous disk space 口”484在4色”主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1) The modified page table mechanism ▶ Page table when some pages are not in main memory 0 A 1 B 2 C 3 D 4 E 5 F 6 G 7 H logical memory 0 4 v 1 i 2 6 v 3 i 4 i 5 8 v 6 i 7 i frame valid-invalie bit 0 1 2 3 4 A 5 6 C 7 8 9 F 10 11 12 13 14 15 PhysicalMemory D C E A B G F H Transfer of a paged memory to contiguous disk space
2)Page Fault(缺页故障) First reference to a page will trap to OS: page fault(缺页故障/异常/中断) Page fault trap(缺页异常) Exact exception(trap),精确异常 Restart the process in exactly the same place and state. Re-execute the instruction which triggered the trap Execution of one instruction may cause multiply page faults 5 Page fault may occur at every memory reference One instruction may cause multiply page faults while fetching instruction or r/w MOV A,B operators Example:One instruction and 6 page faults 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2) Page Fault (缺页故障) ▶ First reference to a page will trap to OS: page fault(缺页故障/异常/中断) ▶ Page fault trap (缺页异常) ▶ Exact exception (trap), 精确异常 Restart the process in exactly the same place and state. Re-execute the instruction which triggered the trap ▶ Execution of one instruction may cause multiply page faults 6 5 4 3 2 1 B: A: MOV A, B Example: One instruction and 6 page faults ▶ Page fault may occur at every memory reference ▶ One instruction may cause multiply page faults while fetching instruction or r/w operators
2)Page Fault(缺页故障) Page Fault Handling: 1.OS looks at an internal table to decide: Invalid reference abort Just not in memory→ 2.Get empty frame 3.Swap page into frame Pager out pager in 4.Modify the internal tables Set validation bit v 5.Restart the instruction that caused the page fault 4口”4814在,4色,主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2) Page Fault (缺页故障) ▶ Page Fault Handling: 1. OS looks at an internal table to decide: ▶ Invalid reference ⇒ abort ▶ Just not in memory ⇒ 2. Get empty frame 3. Swap page into frame ▶ Pager out & pager in 4. Modify the internal tables & Set validation bit = v 5. Restart the instruction that caused the page fault
2)Page Fault(缺页故障) 3 page is on backing store operating system 2 trap 1 reference load M 6 restart instructio free frame 5 reset 4 bring ik page table missing page physical memory Steps in handling a page fault 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2) Page Fault (缺页故障) 4 bring in missing page operating system 3 page is on backing store load M 1 reference ✛ 6 restart instruction i 2 trap free frame physical memory 5 reset page table Steps in handling a page fault
3)address translation Address translation hardware page fault handling 4口”4814在,4色,主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3) address translation ▶ Address translation hardware + page fault handling