Home » Computer Science Organization

Computer Science Organization | Virtual Memory

In this article, we will learn concept of virtual memory in computer system with a block diagram. Explanation on virtual memory address translation and advantages of virtual memory is also prescribed in this article.
Submitted by Abhishek Kataria, on July 18, 2018

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

Virtual Memory in CSO
  • 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:

  1. Virtual address space of the program is divided into fixed length units called, pages.
  2. 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.
  3. The address generated by the processors to fetch the word memory can be divided into the two parts:
  4. Virtual Memory in CSO
  5. 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.
  6. Low order bits of the address gives the offset and it specifies as the particular byte within in a page.
  7. 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.
  8. 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

  1. A process which is larger than the main memory, it will be executed because of the demand paging.
  2. By the concept of a virtual memory, many processes can be maintained in the main memory.
  3. It will allow greater programming level by using only less space for a particular process.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.





Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.