Difference between Virtual Memory and Cache 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. when the content is required, it fetches it back to the RAM. Cache memory is used to store frequently accessed data in order to quickly access the data whenever it is required. They both are conceptually the same; however they mainly differ in the matter of implementation which results in different aspects like speed and control mechanism.

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 that a user has one or more contiguous address spaces that begin with address zero.

Virtual memory generates addresses in one of three ways (for RISC machines) – a load instruction, a store instruction or by fetching an instruction. Virtual memory has several advantages as it uses main memory efficiently. It simplifies memory management as each process acquires the same uniform linear address space. It also isolates address spaces and avoids any process memory clashes.

Cache Memory is a small and high speed memory. It stores data from those addresses of the main memory which are used several times. It can be available as a reserved part of the main memory or exist as an independent high speed storage device. Cache memory can be accessed at a very fast rate than in comparison to normal main memory.

If a processor needs to write or read a location in main memory, it checks the availability of the memory location in the cache. It is done by comparing the address of the memory location to all the tags in the cache which have the possibility of containing that particular address. In case the memory location in found in the cache, it is regarded as a Cache hit, and if not, then in that case it is regarded as a Cache miss.

Virtual and cache memory are conceptually the same. However, they differ in the terms of implementation. This is due to the speed requirements of cache.

Comparison between Virtual Memory and Cache Memory:

 

Virtual Memory

Cache 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.

Cache memory is used to store frequently accessed data in order to quickly access the data whenever it is required. They both are conceptually the same; however they mainly differ in the matter of implementation.

Purpose

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

 

It reduces the amount of time needed to access the data.

 

Speed

It operates in the millisecond range.

It operates in the nanosecond range.

Control mechanism

Managed by the operating system

Managed automatically by the hardware

Component

It is a part of the hard drive (secondary storage).

Located on the processor itself

Image Courtesy: wikimedia.org, moodle.schoolnet.lk

Most Searched in Home and Garden Most Searched in Environment
Most Searched in Education and References Top 10 Most Searched Differences
Slim vs Skinny
Carrier vs Career
B.E. vs B.Tech
Samsung Galaxy S Duos vs Samsung Galaxy S3

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.