What is virtual memory

Virtual memory is the part of a hard drive and is extra memory that works with a combination of RAM (Random Access Memory). RAM is also known as the main memory or physical memory.

The speed of the main memory is very fast as compared to virtual memory.

Virtual Memory Diagram

Suppose you are running some applications of windows e.g. you are running MS Word, Chrome, and Calculator. If for some time you minimize MS Word then this application is inactive and the data of MS Word will be transferred from main memory to virtual memory. The movement of data from main memory to virtual memory is known as a swap out of the process.

Main memory has a limit of space and it can only process a limited number of processes at a time. But virtual memory gives extra space for the processes which are larger to be occupied in the main memory.

When space in main memory exceeds the limit then unused processes are moved from RAM to virtual memory. When the CPU needs those inactive processes then they are moved from virtual memory to RAM this movement of processes is known as a swap-in of process.

Let’s discuss some of the pros and cons of virtual memory.

Advantages of virtual memory

Some benefits of virtual memory are:-

  • By using virtual memory many applications or programs can be executed at a time.
  • Main memory has limited space but you can increase and decrease the size of virtual memory by yourself.
  • Users can run large programs that have a size greater than the main memory
  • The data which is common in memory can be shared between RAM and virtual memory
  • CPU utilization can be increased because more processes can reside in the main memory
  • The cost of buying extra RAM is saved by using virtual memory

Disadvantages of virtual memory

Some drawbacks of virtual memory are:-

  • Virtual memory tends to slow down your computer because the speed of the hard drive is less than RAM
  • Switching between applications takes more time
  • As virtual memory allocates space on the hard drive so for user use the hard drive space becomes less
  • The overall performance of the system is affected
  • The algorithm for virtual memory is difficult to implement

Example of virtual memory

Running multiple application programs at the same time is an example of virtual memory usage. You can run many programs on your PC and if your RAM is small then virtual memory saves your extra programs while running.


Share This Story, Choose Your Platform!