Difference between Virtual Memory and Swap Memory

Key Difference: Virtual memory is an abstraction of the main memory. It extends the available memory of the computer by storing the inactive parts of the content RAM on a disk. Whenever the content is required, it fetches it back to the RAM. Swap memory or swap space is a part of the hard disk drive that is used for virtual memory. Thus, both are also used interchangeably.

Virtual memory is quiet different from the physical memory. Programmers get direct access to the virtual memory rather than physical memory. Virtual memory is an abstraction of the main memory. It is used to hide the information of the real physical memory of the system. It extends the available memory of the computer by storing the inactive parts of the RAM's content on a disk. When the content is required, it fetches it back to the RAM. Virtual memory creates an illusion of a whole address space with addresses beginning with zero. It is mainly preferred for its optimization feature by which it reduces the space requirements. It is composed of the available RAM and disk space.

Swap memory is generally called as swap space. Swap space refers to the portion of the virtual memory which is reserved as a temporary storage location. Swap space is utilized when available RAM is not able to meet the requirement of the system’s memory. For example, in Linux memory system, the kernel locates each page in the physical memory or in the swap space. The kernel also maintains a table in which the information regarding the swapped out pages and pages in physical memory is kept.

 
 

The pages that have not been accessed since a long time are sent to the swap space area. The process is referred to as swapping out. In case the same page is required, it is swapped in physical memory by swapping out a different page. Thus, one can conclude that swap memory and virtual memory are interconnected as swap memory is used for the technique of virtual memory.

Comparison between Virtual Memory and Swap Memory:

 

Virtual Memory

Swap Memory

Definition

Virtual memory is an abstraction of the main memory. It extends the available memory of the computer by storing the inactive parts of the content RAM on a disk. It fetches it back to the RAM when the content is required.

Swap memory or swap space is a part of hard disk drive that is used for virtual memory. Thus, both are also used interchangeably.

 

 

Purpose

It extends the memory capacity of a computer beyond the one that is installed.

To store the pages for temporary storage.

Type

Memory management technique

Area on the hard disk drive

Image Courtesy: webopedia.com, pcmag.com

Most Searched in Pregnancy and Parenting Most Searched in Business and Finance
Most Searched in Environment Most Searched in Food and Drink
Bajaj Pulsar 150cc DTSI vs Bajaj Pulsar 180cc DTSI
Niger vs Nigeria
HTC First vs LG Optimus F5
Workgroup vs Domain

Comments

waal those are rich and easly understandable notes thnx

Add new comment

Plain text

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.