20091201 - Virtual Memory Virtual memory is a mechanism...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Virtual Memory Virtual memory is a mechanism that permits a process to be run without having the entire contents of its address space loaded into main memory at one time. • The part of the address space that is loaded into main memory is called resident . • The remainder is called nonresident . Nonresident data is saved on a secondary storage area, called the backing store . What is VM Good For? A primary purpose of virtual memory is to increase the degree of multiprogramming to obtain more efficient utilization of system resources: • More runnable processes can be kept in main memory at one time. • More runnable processes means increased CPU utilization. Other Uses of VM Some other reasons for having VM are: • Running large applications whose address space exceeds the amount of main memory (but not by too much!). • Decrease apparent startup time for large applications, by allowing applications to start with only a fraction of data resident. • Memory-mapped files provide an useful alternative to tra- ditional I/O system calls. In general, VM decouples applications from details of the hardware configuration. Memory-Mapped Files Page Tables and the MMU Virtual memory requires hardware support to work efficiently: • Virtual address space is partitioned into fixed-size pages . • Physical memory is partitioned into page frames . • Page tables define a mapping from (virtual) pages to (physical) page frames . • Address translation is performed by the MMU on every memory reference. Address Translation The NACHOS MMU Here is how the NACHOS MMU performs address translation: • Given a virtual address VA, decompose into – virtual page number : VPN = ((VA>>7) & 0x1ffffff) – offset in page : OFF = (VA & 0x7f) ( How else could we express this calculation? ) • Lookup page table entry at Machine.pageTable[VPN] . Contents: virtual page number , physical page number . valid flag , read-only flag , use flag , dirty flag . • Check that PTE is valid, and that the type of access (read/write) is consistent with the read-only flag. • Form physical address : PA = ((PPN<<7) | OFF) . Virtual Memory: How does it work? • Nonresident pages are marked invalid in the page table. • Attempts to access invalid pages are detected by MMU, causing a page fault trap to the OS. • The page fault handler “fixes things up”: 1. Allocating a page of memory. 2. Retrieving data from backing store. 3. Marking page table entry valid. 4. Allowing application to continue. Result: VM is transparent to user applications. Virtual Memory Virtual Memory: Performance Issues What affects the effective execution rate of a process running under VM? • Accesses to resident pages execute at main memory speed....
View Full Document

{[ snackBarMessage ]}

Page1 / 55

20091201 - Virtual Memory Virtual memory is a mechanism...

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

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