Q7Computer Architecture
Question
Q.7. Explain memory hierarchy in brief.
Answer
Memory hierarchy organizes computer storage into multiple levels — registers, cache, main memory (RAM), and secondary storage — trading off speed, cost and capacity, with faster, more expensive, smaller-capacity memory closer to the CPU and slower, cheaper, larger-capacity storage farther away.
Memory hierarchy is the organization of a computer system's storage components into multiple levels, arranged to balance the competing goals of speed, cost, and storage capacity, exploiting the fact that programs typically exhibit locality of reference (accessing a relatively small subset of their total data/instructions repeatedly over short time intervals). The hierarchy typically comprises, from fastest/smallest/most expensive to slowest/largest/cheapest: CPU registers (fastest, holding a handful of currently-used values directly within the processor), cache memory (small, very fast memory holding recently/frequently accessed data, often in multiple levels L1/L2/L3), main memory/RAM (larger capacity, moderate speed, holding currently running programs and their data), and secondary storage (hard disk/SSD, largest capacity, slowest, providing long-term, non-volatile storage) — this layered structure allows the overall system to achieve performance close to that of the fastest (but smallest and most expensive) memory level, at a cost closer to that of the slowest (but largest and cheapest) level.