08-vm - Virtual Memory Goals for Today Virtual memory...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Virtual Memory
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Goals for Today • Virtual memory • Mechanism 2 – How does it work? • Policy – What to replace? – How much to fetch?
Background image of page 2
What is virtual memory? • Each process has illusion of large address space – 2 32 for 32-bit addressing • However, physical memory is much smaller • How do we give this illusion to multiple processes? – Virtual Memory: some addresses reside in disk 3 page table Physical memory disk Virtual memory page 0 page 1 page 2 page 3 page 4 page N
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Virtual memory • Separates users logical memory from physical memory. – Only part of the program needs to be in memory for execution – Logical address space can therefore be much 4 larger than physical address space – Allows address spaces to be shared by several processes – Allows for more efficient process creation
Background image of page 4
Swapping vs Paging • Swapping – Loads entire process in memory , runs it, exit – Is slow (for big, long-lived processes) – Wasteful (might not require everything) aging 5 Paging – Runs all processes concurrently, taking only pieces of memory (specifically, pages) away from each process – Finer granularity, higher performance – Paging completes separation between logical memory and physical memory – large virtual memory can be provided on a smaller physical memory The verb “to swap” is also used to refer to pushing contents of a page out to disk in order to bring other content from disk; this is distinct from the noun “swapping”
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
How does VM work? • Modify Page Tables with another bit (“is present”) – If page in memory, is_present = 1 , else is_present = 0 – If page is in memory, translation works as before – If page is not in memory, translation causes a page fault 6 Disk Mem 32 :P=1 4183 :P=0 177 :P=1 5721 :P=0 Page Table 0 1 2 3
Background image of page 6
Page Faults • On a page fault: – OS finds a free frame, or evicts one from memory (which one?) • Want knowledge of the future? – Issues disk request to fetch data for page (what to fetch?) ust the requested page, or more? 7 • Just the requested page, or more? – Block current process, context switch to new process (how?) • Process might be executing an instruction – When disk completes, set present bit to 1, and current process in ready queue
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Steps in Handling a Page Fault 8
Background image of page 8
What to replace? • What happens if there is no free frame?
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 31

08-vm - Virtual Memory Goals for Today Virtual memory...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online