Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems.
Published byModified over 5 years ago
Presentation on theme: "Virtual Memory. Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems."— Presentation transcript:
Why do we need VM? Program address space: 0 – 2^32 bytes –4GB of space Physical memory available –256MB or so Multiprogramming systems –Have more than one program running
What do we do? Paging –Break up the memory space into equal-sized blocks - pages –Put the program into main memory a page at a time Avoids fragmentation –What kind? What about fragmentation within a page?
Address Translation Virtual Addr Physical Addr –If the page is in Physical Memory Otherwise the page is on Disk –Page Fault!
How does the translation work? Going from a 4GB address space to a 512MB address space –Virtual Address bit size? –Physical Address bit size? What’s the page size? –4K, 8K, 16K … –Page offset bit size?
How does the translation work? II Page Number = Address / Page Size –Page Number = higher n-k bits k = number of bits for the page offset
Page Faults What if the page is not in Physical Memory –How do we know? What do we need to do? –Bring the page into PM –What if PM is full? How do we choose a victim? What happens to the victim?
Write Policies Two options: –Write-through –Write-back What are the costs? How do we know when to write? –Do we always write? How does this compare to cache?
Caching the Page Table What does it take to access memory? –getting the instruction –what if it’s a load or a store? Translation-lookaside Buffer (TLB) –Small number of entries –Keeps recently accesses VM PM translations Small hit time Small miss rate