Home »
Computer Science Organization
Virtual Memory in Computer Organization
By Abhishek Kataria, on July 18, 2018
What is Virtual Memory?
The physical memory which we are using in our computer system is in megabytes not in gigabytes. If we try to run a program which is not completely fit into main memory, then, in this case, we try the parts of currently being executed are stored in main memory and remaining portion is stored in a secondary device such as hard disk.
If this case occurs, so it’s necessary that all parts of a program which are needed for execution are first brought into the main memory. When a new segment of a program is brought and memory is full, it must replace another segment already in the memory. So the techniques which are used to move program and data block into the main memory when they required for execution are called virtual memory techniques.
Virtual Memory Organization
- Programmers discern a larger memory which is allocated on the disk this memory is referred to as virtual memory. A programmer enjoys a huge virtual space to develop his or her program or software.
- Program or a processor references a data space which is independent of available physical memory space. The address issued by a processor is called a virtual address.
- The virtual address can be translated into the physical address by a combination of hardware and software components.
- If a virtual address is a part of the program in the physical memory then it can be accessed immediately and if the address is not in the main memory then its content will be brought into the main memory before it can be used.
- To improve the performance hardware are added to the system, these hardware units are known as Memory Management Unit (MMU).
- In the paging system, page table helps us to find the physical address form virtual address since the virtual address space is used to develop a process. So the work of the MMU is to translate the virtual address to physical address.
Paging and Virtual Memory Address Translation
The mechanism for reading a data from memory involves translation of virtual address to physical address. In this basically, the concept of paging is used for doing the translation. Following steps are there for address translations which are given below:
- Virtual address space of the program is divided into fixed length units called, pages.
- Each page will contain a block of words that will occupy the locations in the main memory. After this, each page will be mapped into the fixed location in the main memory called page frame.
- The address generated by the processors to fetch the word memory can be divided into the two parts:
- In this case, high order bits are interpreted as virtual page number and these bits are used to fetch corresponding page frame number from the page table.
- Low order bits of the address gives the offset and it specifies as the particular byte within in a page.
- By adding this virtual page number to the contents of the content page table, the address of the corresponding entry in the page table is obtained.
- Each entry in a page includes a control bit that describes a validity of a page, the status of the page, and whether the page has been modified.
Advantages of Virtual Memory
- A process which is larger than the main memory, it will be executed because of the demand paging.
- By the concept of a virtual memory, many processes can be maintained in the main memory.
- It will allow greater programming level by using only less space for a particular process.