- In some cases the data may be present in physical memory locations that have addresses different from those specified by the program
- The memory control circuitry translates the address specified by the program into an address that can be used to access the physical memory. This address is called logical address or virtual address
- A set of virtual addresses constitute the virtual address space
So Virtual address are Address specified by the program and Physical address are Address where the data is exactly stored
- The mapping function to bring in the contents from physical memory is implemented by a special memory control unit called as memory management unit
- The simplest method of translation assumes that all programs and data are composed of fixed length units called pages
- Each page consists of a block of words that occupy contiguous locations in the main memory or the secondary storage
- Pages normally range from 1K to 8K bytes in length. They form the basic unit of information that is transmitted between main memory and secondary storage devices
Virtual memory translation
- Each virtual address generated by the processor is interpreted as a page number followed by a word number.
- Information about the disk or the main memory is kept in a page table in the main memory.
- The starting address of this table is kept in a page table base register
- By adding the page number to the contents of this register, the address of corresponding entry in the page table is obtained
- The content of this location gives the starting address of the page if that page currently resides in the main memory
- Otherwise they indicate the location where the page is to be found in the secondary storage
- In this case the entry in the table usually points to an area in the main memory where the secondary storage address of the page is held
- Each entry also includes some control bits to describe the status of the page while it is in the main memory
- One control bit indicates whether the page has been modified when it was in the main memory
- If the page table is stored in the main memory unit, then the two main memory accesses must be made for every main memory access requested by the program
- This may degrade the speed performance by a factor of two
- However cache memory is generally used to speed up the translation process
Memory Management
- In virtual memory concept we assumed that only one large program is being executed
- If the program or data does not fir into the physical main memory, then a secondary storage should hold the overflow
- The OS automatically swaps the programs between the main memory and secondary storage
- Virtual address is divided into two parts System space and user space. OS routine reside in system space and user applications in User space
- In a multi-user environment each user will have separate user space with separate page table
- The memory management unit uses a page table base register to determine the address of table to be used in the translation process.
- Hence by changing the contents of this register OS can switch from one space to other
- The physical main memory is thus shared by the active pages of the system space and several user spaces
- However, only the pages that belong to one of these spaces are accessible at any given time
- In a multi-user environment, no program should be allowed to modify either data or instructions of other programs in the main memory
- Hence protection should be given
- Let us consider one simplest form of protection- the processor has two states supervisor and user state
- When OS routines are being executed the processor is in its supervisor state and when user application is being executed the processor is in user state
- So in the user state certain instructions like changing the contents of page table base register is not allowed
Block set associative mapping << Previous
Next >>The VAX -11 Virtual memory system
Support us generously: contact@lessons2all.com
Our aim is to provide information to the knowledge
seekers.