Virtual Memory

Darshan Bachhav
5 min readDec 28, 2021

--

Excited to know about Virtual Memory? Then this blog is for you. In this blog, I have covered almost all vital points related to virtual memory with its applications.

So, let’s have a look at Virtual Memory and see how it may help you memorise incredible information.

What is Virtual Memory?

So let’s talk about what does Virtual Memory means. Virtual Memory is all about the illusion of memory. It creates an illusion to have a large main memory. It treats the part of secondary memory as the main memory. Virtual memory is like the application sees a block of memory of a given size. The application can use this memory as it sees and can fit into it. This block of memory is virtual in the sense that it is combined from different parts. Some of it might be in the main memory of the computer or some may also be on disk.

In this process, the User can load bigger size processes than the available main memory can do. It creates this illusion by having the illusion that the memory is available to load the whole process.
Instead of loading one big process in the main memory, the Operating System divides the process into fragments and loads the fragments in the main memory.

By doing this, the level and grade of multiprogramming will be increased and therefore, the CPU utilization will also be increased. So we can say this memory plays an important role in management too. In short, we can say that It supplies additional “fake” RAM to allow programs to continue functioning.

How to add Virtual Memory in your PC?

Wanna play your favorite big Games? But your pc memory doesn’t support it? Let’s add virtual memory by real steps which are as follows:

Photo by Sean Do on Unsplash

1: Open Desktop, right-click “This PC”, and choose“Properties”.

2: Choose “Advanced system settings” in the pop-up window.

3: In the “System Properties” window, click the “Advanced” tab, and then click “Settings” under “Performance”.

4: In the “Performance Options” window, click the “Advanced” tab, and then click “Change” under “Virtual memory”.

5: Uncheck “Automatically manage paging file size for all discs” in the “Virtual Memory” window, then select a relatively clear place to store the Pagefile.sys file.

6: Choose “Custom size” and then enter a new size of your choice in the MegaBytes in the Initial size (MB) or Maximum size (MB) box. Here, The suggested size is 1.5–3 times the amount of RAM on your machine in this case.

7: Click “Set”, and then click “OK”.

It’s all set now. You have successfully added memory to your pc. Looks amazing right?.

Why do we need Virtual Memory?

Here, is the reason for using virtual memory:

  • Whenever your computer doesn’t have space in the physical memory(RAM) it writes what it needs to remember in the hard disk in the form of virtual memory.

Now let’s learn how does it work.

How it works?

Let’s understand its working through an example

Let’s assume that an OS requires 500 MB of memory to store all the running programs. However, there’s currently only 100 MB of available physical memory stored on the RAM.

  • The OS will then set up 400 MB of virtual memory and use a program called the Virtual Memory Manager(VMM) to manage that 400 MB.
  • So, in this case, the VMM will create a file on the hard disk that is 400 MB in size to store the extra memory that is required.
  • The OS will now proceed to address memory as it considers 500 MB of real memory stored in the RAM, even if only 100 MB space is available.
  • It is the job of the VMM to manage 500 MB memory even if just 100 MB of real memory space is available.

Let`s have a look at some of its advantages and disadvantages.

Advantages

Here are the pros of using Virtual Memory

  • Virtual memory helps to gain speed when only a particular fragment of the program is required to execute program.
  • It helps implement a multitasking environment.
  • It allows you to run more applications in one go.
  • Common data can be shared between memory.
  • Many processes should be maintained in the main memory, which increases the effective use of the CPU.
  • We can run many applications at the same time.

Disadvantages

Here are the cons of using virtual memory:

  • If a system is using Virtual Memory the application tends to run slower.
  • It takes time if we want to switch between applications
  • As the memory of hard drive is used to increase virtual memory lesser space is available for your hard drive for use.
  • There is a performance difference between RAM and Virtual Memory.
  • Occupy the storage space, which may be used for long-term data storage.

So here our blog ends. I hope you found this blog helpful and informative and got an overall idea about Virtual Memory.

References:

Demand Paging | Advantages of virtual memory | Disadvantages of virtual memory | Techtud

Virtual Memory — javatpoint

What Is the Virtual Memory? How to Set It? (Complete Guide) (minitool.com)

Virtual Memory in OS: What is, Demand Paging, Advantages (guru99.com)

--

--