Back to ComputerTerms
Virtual Memory
There are two main motivations for Virtual Memory:
- To allow efficient and safe sharing of memory among multiple programs
- To remove the programming burdens of a small, limited amount of main memory.
Virtual memory implements the translation of a program's address space to physical addresses. This translation process enforces protection of a program's address space from other programs.
In times past programmers had to make sure their programs fit in the memory available, Virtual memory overcomes this by relieving the programmer of this task.
KEY: A Virtual Memory Block is called a page
KEY: A Virtual Memory Miss is called a page fault
KEY: The CPU produces a Virtual Address.
The process of mapping virtual memory addresses to physical memory address is called memory mapping or address translation. Virtual memory also provides relocation functionality. This allows us to load the program in any physical memory location (remember that DOS required you to run your program in the lower 640K of memory). Further memory is allocated in fixed size blocks (pages) eliminating the need to find a contiguous block of memory to allocate to a program. (Remember that memory references in a program are offsets that assume contiguous memory use.)
FORMAT:
Virtual Page Number |
Page Offset |
Note that since physical memory is allocated in pages, that the page offset for virtual and physical addresses don't change.
https://www.scotnpatti.com/images/vitualMemorytranslation.jpg
Essentially Memory is a cache for the disk drive system. When we view it in this way we need to consider the extreme difference in speed between the memory and the disk drive. To minimize the effects of this difference we employ the following techniques:
- Pages should be large enough to amortize the high access time.
- Page placement is fully associative
- Page faults can be handled in software because the overhead will be small compared to the disk access time
- The Write-through method will not work with virtual memory since writes take too long. Instead VM systems use write-back schemes.
Back to ComputerTerms