What is Memory Hierarchy and their needs?
Memory Hierarchy:
CPU registers are at the top and a fast cache memory is there between the CPU and main memory. The hard disk is used by the technique of virtual memory to expand the capacity of main memory. In computer language this kind of hierarchy is known as the memory hierarchy. This is applied to get larger memory space at low cost.
Not only that the fast memory has low storage capacity but it needs power supply till the information needs to be stored and are costly. Memories with less cost have high access time. Thus, the cost versus access time paves the way for memory hierarchy. It is used to get high access rate at low cost of memory. A computer system uses a memory system which comprises of these groups of memories:
Internal or CPU memories:
These are internal to the processor. These consist of small set of high speed registers and are used as temporary locations where actual processing takes place.
Primary memory:
This is a fast memory but not as fast as the processor’s internal memory. The storage capacity is small and high cost per bit storage is there. This memory is accessed directly by the processor. It stores programs and data which are currently needed by the CPU.
Secondary memory:
This memory provides scope of larger data storage. Access time is higher than the main memory. This is permanent in nature. The following diagram shows memory hierarchy.
The following memories are here used:
- CPU (register)
- Cache memory
- Main memory
- Secondary storage, and
- Mass storage
On top of the memory hierarchy memory has faster access time, less capacity and higher cost per bit stored. At the bottom there is larger storage capacity, slower access time and lower cost per bit stored.
The cache memory is used in between the CPU and the main memory to enhance the speed of main memory. After main memory secondary memory comes, which can be divided in magnetic disk and magnetic tapes. These are used for long term storage. Magnetic tapes are usually used for backup purpose.