Why Do Computers Have 3 Types of Memory? | Programming Fundamentals #1

We know that memory is used to store data and there are 3 types of memory we use in daily life:
1)Cache memory:- which is used to store frequently used data and it is present close to the CPU.
2)Main Memory:- All programs are loaded and stored here during execution and it is also called volatile/temporary memory(because everything is lost when the system shuts down).
3)Secondary Memory:- It is used to store permanent information and data. Here we have 2 categories-first is Internal storage(SSD, HardDisk) and second is External storage(PenDrive, SDcard, etc).
But the main question is: why do we have 3 types of memory?
For an ideal memory they should obey 3 below desirable features:-
a)Memory should have low access time.
b)Cost of memory should be low.
c)Capacity to store data should be High.
However, None of these 3 types of memory have all these features:-
1)Cache Memory:-
-Low access time
-High Cost
-Low Capacity
2)Main Memory:-
-This memory is moderate in all these three features.
3)Secondary Memory:-
-High access time
-Low Cost
-High Capacity

