What is Virtual memory?

Hello, welcome to another blog post. In this post, we are going to be look at virtual memory. What is virtual memory or virtual RAM on a smartphone?

This topic, at this point in time, is super important. Is someone asking “why?”. Well, if you look at all the new android phones coming through, a lot of them are advertising virtual memory (or RAM extension) as a feature.

This is the new buzzword that has come to town, but it is not very understood. I have spoken to a lot of people and I can confirm this. That is why I am writing this post.



The concept

I am going to try to explain the concept of virtual memory before attempting to define it. I have seen people define it as allocating some part of the internal storage for system use. While this is true, it doesn’t fully explain the concept.

The term virtual means not physically existing as such but made by software to appear to do so. Every smartphone has software for handling memory. This software contains the addresses and pages of every data and task on your phone. Now, software does not work alone, it needs to paired up with hardware.

Virtual Memory and RAM

When you boot up software into a 2GB RAM device, the software should recognize that there is only 2GB of space on the RAM. In turn, it would then only create 2GB of virtual memory which it would map on (assign) to the available RAM space.

If you booted software onto a 4GB or 6GB RAM device, it would also do the same thing. Create virtual memory according to the available RAM space and assign accordingly.

So what if you wanted more memory but do not have the available memory in hardware? This is where virtual memory comes in.


Read: Smartphone RAM explained


What is virtual memory?

Virtual memory is an extension of the software memory beyond the limits of the available hardware. Let’s say that you have only 4GB of RAM but you want 6GB (an extra 2GB). The software would then enlarge the virtual memory from 4GB to 6GB.

Virtual memory

But wait a minute. If software needs hardware to function, what hardware would the extra 2GB of memory run on? This is where your internal storage comes in to play. You the user is going to have to sacrifice 2GB of your internal storage to support the added memory.


Read: What is zRAM?


How it works?

As much as companies would want to have you believe that virtual memory is RAM, it is not. This is because the physical location of the software extension is located on an entirely different block of memory.

What Virtual memory does is to act as a location for swapping. Swapping is defined as process of moving running app processes to an alternate storage. In this case, Swapping means moving running app processes from RAM to Internal Storage.

Virtual memory

So whenever the RAM gets filled up, the operating system simply removes low priority apps and swaps them to the virtual memory located on the internal storage. When the app is needed, the operating system would swap it back into the main RAM.

Android moves (swaps) processes from RAM to Storage using Kernel Swap Daemon (Kswapd).


With that we have come to the end of this post. I hope the explanation was super clear.

Please leave a comment if you have any difficulty and remember to:

Leave a Reply

Your email address will not be published. Required fields are marked *