2. Introduction to Memory Hierarchy
Memory hierarchy refers to the
organization of different types of memory in
a computer system.
It helps in achieving a balance between
cost, capacity, and performance.
The hierarchy consists of multiple levels,
each with varying characteristics and
speeds.
3. Level 1 Cache
The Level 1 (L1) cache is the fastest and
closest to the CPU.
It is typically divided into separate
instruction and data caches.
L1 cache stores frequently accessed data
and instructions to reduce latency.
4. Level 2 Cache
The Level 2 (L2) cache is larger but slower
than the L1 cache.
It acts as a backup to the L1 cache and
stores additional data.
L2 cache improves performance by
reducing the frequency of accessing main
memory.
5. Main Memory
Main memory, also known as Random-
Access Memory (RAM), is larger but slower
than the cache.
It stores data and instructions that are
actively used by the CPU.
Main memory provides fast access to data,
but its capacity is limited compared to
secondary storage.
6. Virtual Memory
Virtual memory uses a combination of main
memory and secondary storage (such as a
hard disk) to increase the effective memory
capacity.
It allows programs to address more
memory than is physically available.
Virtual memory enables efficient
multitasking and supports large
applications.
7. Secondary Storage
Secondary storage devices, like hard disks
and solid-state drives (SSDs), offer large
storage capacity.
They are slower than main memory but
provide non-volatile storage.
Secondary storage is used for long-term
data storage and program files.
8. Register Files
Register files are the fastest form of
memory and are located within the CPU.
They store data and instructions that are
immediately needed by the CPU.
Register files have limited capacity and are
accessed directly by the CPU's arithmetic
and logic units.
9. Memory Hierarchy Summary
Memory hierarchy is essential for
optimizing computer system performance.
It consists of cache levels, main memory,
virtual memory, secondary storage, and
register files.
Each level of the hierarchy provides a
trade-off between speed, capacity, and
cost.
10. References
Computer Organization and Design: The
Hardware/Software Interface by David A.
Patterson and John L. Hennessy.
Computer Architecture: A Quantitative
Approach by John L. Hennessy and David
A. Patterson.
Memory Hierarchy and Caching