Virtual Memory Address Translation
Virtual Memory Address Translation
In a virtual memory system, the program memory is divided into fixed sized pages and allocated in fixed sized physical memory frames. The pages do not have to be contiguous in memory. A page table keeps track of where each page is located in physical memory. This allows the operating system to load a program of any size into any available frames. Only the currently used pages need to be loaded. Unused pages can remain on disk until they are referenced. This allows many large programs to be executed on a relatively small memory system. A resident flag in the page table indicates whether or not the page is in memory. The page table also includes several other flags to keep track of memory usage. A use flag is set whenever the page is referenced. A dirty bit is set whenever the page is changed to inform the operating system that the page in memory is different than the page on disk. There are several virtual memory parameters set by a system designer: Maximum Virtual Address space The size of a program address is determined by the maximum size of the virtual address space. The number of bits in a virtual address is the log base 2 of this value. The amount of real memory that the system can support determined the number of bits needed to address the physical memory. The size of a physical address is log base 2 of this value. This is the size of a virtual memory page and a physical memory frame. It is always a power of 2.
Size of a page
The addresses that appear in programs are the virtual addresses or program addresses. For every memory access, either to fetch an instruction or data, the CPU must translate the virtual address to a real physical address. A virtual memory address can be considered to be composed of two parts: a page number and an offset into the page. The page number determines which page contains the information and the offset specifies which byte within the page. The size of the offset field is the log base 2 of the size of a page. Consider an example system with: 16MB Maximum Virtual Address space (24 bits) 8MB Maximum Physical Address space (23 bits) 1024byte Page size (10 bits) The virtual addresses can be represented as
10 bits offset
To convert a virtual address into a physical address, the CPU uses the page number as an index into the page table. If the page is resident, the physical frame address in the page table is concatenated in front of the offset to create the physical address.
1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11.
+You Search Images Maps Play YouTube News Gmail Documents Calendar More 1. 2. 3. 4. 5. 6.
7. 8.
computer a
1. 2. Sign in
Books
No eBook available
Routledge A1Books.co.in Rediff Books Flipkart Infibeam All sellers
0 ReviewsWrite review