Demand Paging(按需调页 Do not load the entire program in physical memory at program execution time. NO NEED! Bring a page into memory only when it is needed 1.Less I/O needed 2.Less memory needed 3.Faster response 4.More users A page is needed Reference to it Invalid reference =Abort Not-in-memory =Bring to memory 4口”4814在,4色,主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Demand Paging (按需调页) ▶ Do not load the entire program in physical memory at program execution time. NO NEED! ▶ Bring a page into memory only when it is needed 1. Less I/O needed 2. Less memory needed 3. Faster response 4. More users ▶ A page is needed ⇐ Reference to it ▶ Invalid reference ⇒Abort ▶ Not-in-memory ⇒Bring to memory
Demand Paging(按需调页) Swapper VS.Pager A swapper manipulates the entire processes Lazy swapper Never swaps a page into memory unless the page will be needed Swapper that deals with individual pages is a pager swap out 0▣1▣2☐3▣ program A 4白5白6白7白 8☐9▣10☐11☐ 12☐13☐14☐15☐ program swap in 16☐17▣18口19口 20☐21☐22☐23☐ MainMemory Transfer of a paged memory to contiguous disk space 4在4色”主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Demand Paging (按需调页) ▶ Swapper VS. Pager ▶ A swapper manipulates the entire processes ▶ Lazy swapper Never swaps a page into memory unless the page will be needed ▶ Swapper that deals with individual pages is a pager MainMemory program A program B 8 9 10 11 4 5 6 7 0 1 2 3 12 13 14 15 16 17 18 19 20 21 22 23 swap out swap in Transfer of a paged memory to contiguous disk space
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
Hardware support 1.The modified page table mechanism 2.Page fault 3.Address translation 4.Secondary memory (as swap space) 4口”4814在,4色,主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Hardware support 1. The modified page table mechanism 2. Page fault 3. Address translation 4. Secondary memory (as swap space)
1)The modified page table mechanism 1.Valid-Invalid Bit (PRESENT bit) With each page table entry a valid-invalid bit is associated Frame#valid-invalid bit pv→in-memory,.i→not-in-memory Initially valid-invalid bit is set to i on all entries During address translation,if valid-invalid bit in page table entry is i →page fault 2.Reference bits(for pager out) 3.Modify bit(or dirty bit) page table 4.Secondary storage info(for pager in) 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1) The modified page table mechanism 1. Valid-Invalid Bit (PRESENT bit) ▶ With each page table entry a valid-invalid bit is associated ▶ v ⇒ in-memory, i ⇒ not-in-memory ▶ Initially valid-invalid bit is set to i on all entries ▶ During address translation, if valid-invalid bit in page table entry is i ⇒ page fault 2. Reference bits (for pager out) 3. Modify bit (or dirty bit) 4. Secondary storage info (for pager in) Frame# valid-invalid bit v v v v i ... i i page table