Difference between Virtual Memory and Swap Memory


Memory Game:

Memory is an essential part of both the functioning of human or machine. The person without the memory can’t function properly, neither is the machine. The human memory is God gift and no one can understand its functioning, but machine memory is created by the humans for the better performance of the machine. The memory of the computer is mainly distinguished in two major parts. Virtual memory and Swap memory are the two working memories installed in any computer system.

Virtual memory is the abstraction of the main memory of the computer. It extends the available memory of the computer by storing the inactive parts of the content RAM on a disk.  Whenever the running program required space it retrieves back from the RAM. Well, in other sense we can say that Virtual Memory is the combination of RAM and space disk which can use by running process. There have been many confusions going on about the functioning and definition of the Virtual Memory, and it is compared with the following concepts.

  1. Using disk pages to extend the conceptual amount of physical memory a computer has – The correct term for this is actually Paging and numerous none technical persons compared it with the Virtual memory.

  2. An abstraction used by various OS/CPUs to create the illusion of each process running in a separate contiguous address space.

Swap memory is the second type of memory which used when the Virtual memory aka RAM is full or unable to work. So one can say Swap memory or Swap space is the part of virtual memory which is reserved for the temporary storage. This memory is only used when RAM doesn’t function properly or rather it is full.

Let’s take an example of Linux kernel to better understand the Swap memory. In the Linux memory system, the kernel stores the page in the temporary memory. The kernel also maintains a table in which the information regarding the swapped out pages and pages in physical memory is kept. The page which isn’t used for a long time is stored in the physical memory and user can easily restore them. This process is called as the swap out. The user can easily add the page to the main memory any time with this page swap out. Thus both virtual memory and swap memory are interchangeable and can be work as each other substitute easily.

But still both the memories have some basic working difference between with each other such as:

  1. Virtual memory is the main memory of the system and can retrieve the file from the system whenever required. But swap memory is a temporary memory and only used when RAM fails or full.
  2. The virtual memory is capable to extends the memory capacity of a computer beyond the one that is installed. Whereas swap memory is simply a temporary storage space for the page.
  3. Virtual memory is Memory management technique of the computer and Swap is just the area on the hard disk drive.

Final Verdict.

Virtual memory and Swap memory can be interchangeable with each other, but they work totally different from each other. But both the virtual memory and swap memory are equally important for the working of computer system properly.

About the author

Arpit Agarwal

I am a freelancer content writer, web developer and Video editor who loves to write technical stuff and on the other hand makes awesome videos as well. I like to make people happy with my writing and also try to make sure, you come back to read more.

By Arpit Agarwal

Most common tags

%d bloggers like this: