Difference between RAM and Cache

1. Random Access Memory (RAM) :
Random Access Memory (RAM) is used to store the programs and data being used by the CPU in real-time. The data on the random access memory can be read, written, and erased any number of times. RAM is a hardware element where the data being currently used is stored. It is a volatile memory. Two types of RAM are Static RAM, or (SRAM) and Dynamic RAM, or (DRAM).

2. Cache Memory :
Cache is a smaller and fast memory component in the computer which is inserted between the CPU and the main memory. To make this arrangement effective. The cache needs to be much faster than main memory. This approach is more economical than the use of fast memory devices to implement the entire main memory.

Difference between RAM and Cache :

1. RAM is a volatile memory which could store the data as long as the power is supplied. Cache is a smaller and fast memory component in the computer.
2. The size of ram is greater. The size of cache memory is less.
3. It is expensive. It is not expensive.
4. It holds programs and data that are currently executed by the CPU. It holds frequently used data by the CPU.
5. It is not fastest as compared to cache. It is faster.
6. Cache memory increase the accessing speed of CPU. RAM is faster than a hard disk, floppy disk, compact disk, or just any form of secondary storage media.
7. CPU reads Cache Memory data before reading RAM.

CPU reads RAM data after reading Cache Memory.

8. It can be internal and external both. It is generally internal.

Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :
Practice Tags :