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 Arts and Humanities Most Searched in Entertainment and Music
Most Searched in Society and Culture Most Searched in Electronics
New York vs Chicago
Kickboxing vs Muay Thai Boxing
Thin vs Slim
Nokia Lumia 928 vs iPhone 5

Comments

Not able to see full table.contents are precise and accurate from first definitions. Helpful notes ..

Thanks.helpful

thank you

Great explanation..keep rocks

greate good article thanx

thanks! helped in understanding concept precisely

Well prepared topic which describes cache and virtual memory and their difference clearly ...

Nice difrent between catche and virtual memory and good definations

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.