Home » Operating Systems

Differences between Cache Memory and Virtual Memory | Operating System

Cache vs Virtual Memory: Here, we are going to learn what are the differences between Cache Memory and Virtual Memory in Operating System?
Submitted by Monika Jha, on September 19, 2019

Cache Memory

In memory hierarchy, there is an additional level of memory which is Cache. It is high-speed storage and much faster than the main storage. It is much expensive as compared to main storage. So, a relatively small amount of cache is used.

Programs and data need to be in main storage to be executed. Program or data not needed immediately may be kept on secondary storage until needed and then brought into main memory for reference.

Cache storage imposes this level of shuttling on the system. Programs in the main memory shuttled to the cache before being executed. In the cache, they may be executed much faster than in the main storage.

There is a cache hit when the cache has a copy of the required data and there is a cache miss if the cache does not have a copy of that data item.

The overhead involved in shuttling programs back and forth will be reduced so the performance increase obtained by the faster execution possible in the cache.

Cache memory is a faster memory type that acts as a buffer between main memory and the processor.

Virtual Memory

It is a memory management scheme that permits the execution of various processes which may not be entirely in RAM. It is possible that user programs can be larger than physical memory.

A 'swap file' is created in this area which is used to sustain data which the processor does not need in a frequent amount of time.

It makes the programming much simpler because the programmer doesn't have to take care of the size of the physical memory available.

By this CPU utilization and throughput increases as the user utilizes less physical memory. So more users can keep their programs in memory.

Cache Memory and Virtual Memory | Operating System

Dissimilarities / Differences between and Virtual and Cache Memory

Virtual Memory Cache Memory
The term "virtual memory" refers to space allocated on a hard disk where data can be stored for fast access. Cache memory is a small high-speed memory usually Static RAM (SRAM) that contains the most recently accessed pieces of main memory.
Virtual memory enlarges the volume of RAM. By using cache Access time consumed by the processor is less as compared to main memory.
Operating system has the control over virtual memory. Hardware has the control over cache memory.
The size of virtual memory is more than cache memory. The size of Cache memory is less than virtual memory.
In virtual memory, larger programs can be executed while there is a sufficiently small amount of main memory. The cache contains data items that are most frequently used by the processor while the whole program resides in the secondary memory.




Comments and Discussions




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.