Virtual Memory
Virtual memory is a memory management capability of an operating system (OS) that uses hardware and software to allow a computer to compensate for physical memory shortages by temporarily transferring data from random access memory (RAM) to disk storage. In other words, it is the separation of logical memory from physical memory. This separation provides large virtual memory for programmers when only small physical memory is available.
Virtual memory is used to give programmers the illusion that they have a large memory even though the computer has a small main memory. It makes the task of programming easier because the programmer no longer requires worrying about the amount of physical memory available.
What You Need To Know About Virtual Memory
- Virtual memory can be described as the amount of physical hard drive space used to store additional memory that the RAM is unable to store.
- Virtual memory increases the capacity of the main memory i.e increases the degree of multiprogramming.
- Virtual memory is managed by the operating system (OS).
- Virtual memory requires mapping structures to map virtual address to physical address.
- Virtual memory slows down the computer as it takes a lot of energy and time to access data from the hard drive to be used.
- Usually programs with larger size than the main memory are executed in the virtual memory.
- Virtual memory is usually larger in size than cache memory.
- Virtual memory it cannot be described as a memory unit, it’s a technique.
Cache Memory
Cache memory, also referred to as CPU memory, is high-speed static random access memory (SRAM) that a computer microprocessor can access more quickly than it can access regular random access memory (RAM).
Cache memory is used to reduce the average time to access data from the main memory. The cache is a smaller and fast memory which stores copies of the data from frequently used main memory locations. The computer processor can access this information quickly from the cache rather than having to get it from computer’s main memory. Fast access to these instructions increases the overall speed of the program. There are various different independent caches in a CPU, which store instructions and data.
What You Need To Know About Cache Memory
- Cache memory is a small high-speed memory usually Static RAM (SRAM) that contains the most recently accessed pieces of main memory.
- Cache memory increases the accessing speed of CPU.
- Cache memory is managed by the hardware.
- No mapping structures are required in a cache memory.
- Cache memory lessens the amount of time required to access data.
- Usually recently used data is one that is copied or captured in the cache memory.
- The size of cache memory is smaller (less) than that of virtual memory.
- Cache memory can be described as a memory unit.
Also Read: Difference Between von neumann architecture And Harvard Architecture
Difference Between Cache Memory And Virtual Memory In Tabular Form
BASIS OF COMPARISON | CACHE MEMORY | VIRTUAL MEMORY |
Description | Cache memory is a small high-speed memory usually Static RAM (SRAM) that contains the most recently accessed pieces of main memory. | Virtual memory can be described as the amount of physical hard drive space used to store additional memory that the RAM is unable to store. |
Function | It increases the accessing speed of CPU. | It increases the capacity of the main memory i.e increases the degree of multiprogramming. |
Management | It is managed by the hardware. | It is managed by the operating system (OS). |
Mapping | No mapping structures are required in a cache memory. | It requires mapping structures to map virtual address to physical address. |
Advantage/Disadvantage | Cache memory lessens the amount of time required to access data. | It slows down the computer as it takes a lot of energy and time to access data from the hard drive to be used. |
Execution Of Data/Program | Usually recently used data is one that is copied or captured in the cache memory. | Usually programs with larger size than the main memory are executed in the virtual memory. |
Size | The size of cache memory is smaller (less) than that of virtual memory. | Virtual memory is usually larger in size than cache memory. |
Memory Unit | Cache memory can be described as a memory unit. | Virtual memory it cannot be described as a memory unit, it’s a technique. |