Resume the execution Context save(保存现场) Before OS handling the page fault,the state of the process must be saved Example:record its register values,PC Context restore(恢复现场) The saved state allows the process to be resumed from the line where it was interrupted NOTE:distinguish the following 2 situation Illegal reference=The process is terminated Page fault=Load in or pager in “口4814在4生,主QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Resume the execution ▶ Context save (保存现场) Before OS handling the page fault, the state of the process must be saved ▶ Example: record its register values, PC ▶ Context restore (恢复现场) The saved state allows the process to be resumed from the line where it was interrupted. ▶ NOTE: distinguish the following 2 situation ▶ Illegal reference⇒The process is terminated ▶ Page fault⇒ Load in or pager in
Outline Demand Paging(按需调页) Basic Concepts (Hardware support) Performance of Demand Paging 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Outline Demand Paging (按需调页) Basic Concepts (Hardware support) Performance of Demand Paging
Performance of Demand Paging Letp=Page Fault Rate(0≤p≤l.o If p =0,no page faults If p =1.0,every reference is a fault Effective Access Time(EAT) EAT (1-p)x memory access +p x page fault time page fault time page fault overhead +swap page out +swap page in +restart overhead 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Performance of Demand Paging ▶ Let p = Page Fault Rate (0 ≤ p ≤ 1.0) ▶ If p = 0, no page faults ▶ If p = 1.0, every reference is a fault ▶ Effective Access Time (EAT) EAT = (1 − p) × memory access +p × page fault time page fault time = page fault overhead +swap page out +swap page in +restart overhead
Performance of Demand Paging Example Memory access time =200ns Average page-fault service time 8ms EAT=(1-p)×200+p×8ms (1-p)×200+p×8,000,000 =200+p×7,999,800 1.If one access out of 1,000 causes a page fault,then p=0.001 EAT=8,199.8ns=8.2μs This is a slowdown by a factor of=40!! 200n5 口“814在4生”主刀QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Performance of Demand Paging ▶ Example ▶ Memory access time = 200ns ▶ Average page-fault service time = 8ms EAT = (1 − p) × 200 + p × 8ms = (1 − p) × 200 + p × 8, 000, 000 = 200 + p × 7, 999, 800 1. If one access out of 1,000 causes a page fault, then p = 0.001 EAT = 8, 199.8ns = 8.2µs This is a slowdown by a factor of 8.2us 200ns = 40!!
Performance of Demand Paging Example Memory access time =200ns Average page-fault service time =8ms EAT=(1-p)×200+p×8ms =(1-p)×200+p×8,000,000 =200+p×7,999,800 2.If we want performance degradation 10%,then EAT=200+p×7,999,800<200(1+10%)=220 p×7,999,800<20 P<20/7,999,800≈0.0000025 口”4814在年生”主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Performance of Demand Paging ▶ Example ▶ Memory access time = 200ns ▶ Average page-fault service time = 8ms EAT = (1 − p) × 200 + p × 8ms = (1 − p) × 200 + p × 8, 000, 000 = 200 + p × 7, 999, 800 2. If we want performance degradation < 10%, then EAT = 200 + p × 7, 999, 800 < 200 (1 + 10%) = 220 p × 7, 999, 800 < 20 p < 20/7, 999, 800 ≈ 0.0000025