'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
Last Updated: Dec 22, 2023
Medium

Design and Characteristics of Memory Hierarchy

Author Soumya Agrawal
2 upvotes
gp-icon
Data structures & algorithms (Beginner to Intermediate)
Free guided path
13 chapters
99+ problems
gp-badge
Earn badges and level up
memory hierarchy

Introduction

A computer system consists of various types of memory devices. The organization of these memory types so as to minimize the access time is known as memory hierarchy. The computer storage is separated into a hierarchy based on the response time.

The memory hierarchy levels are CPU registers, cache memory, main memory or primary memory, magnetic disks or secondary memory, and Optical disks or magnetic types or tertiary memory.

We will explain Memory Hierarchy and it's characteristics in detail.

What is Memory Hierarchy?

 

cpu memory hierarchy

 

The memory hierarchy is the arrangement of various types of storage on a computing system based on access speed. It organizes computer storage according to response time. Since response time, complexity, and capacity are all connected, the levels can also be distinguished by their performance and controlling technologies.

As shown in the above picture, the computer memory has a pyramid-like structure. It is used to describe the different levels of memory. It separates the computer storage based on hierarchy.

As you can see, capacity is increasing with time. This Memory Hierarchy Design is divided into 2 types:

  • Primary or internal memory
    It consists of CPU registers, Cache Memory, Main Memory, and these are directly accessible by the processor.
     
  • Secondary or external memory
    It consists of a Magnetic Disk, Optical Disk, Magnetic Tape, which are accessible by processor via I/O Module.

 

Let's focus on each memory level in detail to better understand the topic.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job
Bootcamp

Types of Memory Hierarchy

The Memory hierarchy is further classified into two types:

  1. Internal Memory
  2. External Memory

1. Internal Memory

It is also called primary memory. Internal memory is a part of your computer that, when running, can store small amounts of data that need to be accessed quickly. This type of memory is directly reachable by the process through the I/O module. It consists of RAM, ROM, and cache memory.

RAM

It is a volatile memory that is used to store whatever is in use by the computer, and it acts as a middle man between the CPU and the storage device, which helps speed up the computer. It has many forms, but the most common type is DDR3.

ROM

ROM, unlike other internal memory, is non-volatile. ROM stands for read-only memory, meaning the user cannot write data to the ROM without special access. It was designed so that the computer could access the bios without other parts of hardware.

Cache

It is a really small, super-fast memory found in various computer components. The CPU cache stores small bits of frequently accessed data from the RAM so that the processor doesn't have to wait for the RAM to respond every time it wants the same piece of information. Like RAM, it is volatile and wipes clear whenever the computer gets turned off.

2. External Memory

It is also known as secondary memory. Since it has a huge capacity, it stores massive data. Presently, it can measure the data in hundreds of megabytes or even in gigabytes. The critical property of external memory is that stored information will not be lost whenever the computer switches off. It consists of magnetic tape, a magnetic disk, and an optical disk.

Magnetic tape

It is a medium for magnetic storage, a thin, magnetizable coating on a long, narrow strip of plastic film. It is used for many purposes, like hanging signs and displays for business recording audio in a recording tape to store the data on a hard disk. Alternatively, we can use it for keeping things in a house or a garage.

Magnetic disk

Magnetic disks are flat circular plates of metal or plastic coated on both sides with iron oxide. Input signals, which may be audio, video, or data, are recorded on the surface of a disk as magnetic patterns or spots in spiral tracks by a recording head while a drive unit rotates the disk. It is relatively cheap per storage unit, with Fast access and retrieval times compared to other storage devices.

Optical disk

It is an electronic data storage medium that can be written to and read using a low-powered laser beam. Optical disks are often stored in exceptional cases, sometimes called jewel cases, and are most commonly used for digital preservation, music, video, or data and programs for personal computers. Optical media provides many advantages for storing data over conventional magnetic disks, such as mass storage capacity, mountable/unmountable storage units, and low cost per bit of storage.

System Supported Memory Standards

According to the memory Hierarchy Design, the system supports memory standards are show below in the table:

Level 1 2 3 4
Name Register Cache Main Memory Secondary Memory
Size < 1KB < 16 MB < 16 GB > 100 GB
Implementation Multi ports On-chip/SRAM DRAM Magnetic
Access Time  0.25-0.5ns 0.5-25ns 80ns-250ns 50 lakh ns
Bandwidth 20k to 1lakh MB 5k to 15k 1k to 5k 20 to 150
Managed by Compiler Hardware OS OS
Backing Mechanism From cache From main memory from secondary memory from ie

Characteristics of Memory Hierarchy

The memory characteristics mainly include:

  • Access Time: The interval between data availability and a read or write request.
     
  • Capacity: The amount of information that can be stored increasing as we move from top to bottom in the hierarchy.
     
  • Performance: Historically, designing a computer system without a memory hierarchy resulted in a significant speed gap between main memory and CPU registers, leading to lower system performance. The memory hierarchy model was introduced to address this issue and improve system performance.
     
  • Cost Per Bit: Moving from bottom to top in the system's hierarchy, the cost per bit increases, meaning that internal memory is costlier than external memory.

Memory Hierarchy Design

The main types of memory hierarchy include cache memory, main memory (RAM), secondary storage (hard disks), and tertiary storage (optical disks or magnetic tapes).

1. Cache Memory 

It is the fastest type of memory and is located closest to the CPU. It stores frequently accessed data and instructions, making it faster to retrieve them than from the main memory. There are typically two or three levels of cache memory, with each level having a larger capacity and slower access speed than the previous level.

2. Main Memory

It is the primary memory of a computer system. It is slower than cache memory but faster than secondary storage. The data and instructions stored in the main memory can be accessed directly by the CPU.

3. Secondary Storage 

Secondary storage such as hard disks, is used for long-term storage of large amounts of data that cannot fit in the main memory. It is slower than the main memory but has a much larger capacity and is persistent (i.e., retains data even when the power is turned off).

4. Registers

Registers are the fastest and smallest type of memory, located directly within the central processing unit (CPU). They store small amounts of data that are frequently accessed by the CPU. They also hold data, instructions, and control information that the CPU needs to perform operations. The storage capacity for registers ranges from 16 to 64 bits.

5. Magnetic Disks

Magnetic disks, like HDDs, store data magnetically on spinning platters. They offer high storage capacity and support both sequential and random access. However, they are less durable and slower than solid-state drives (SSDs). Still used for bulk data storage in some systems, they provide cost-effective storage options for various applications.

6. Magnetic Tape

Magnetic Tape is a sequential data storage medium consisting of a long plastic ribbon coated with a magnetic material. It's known for its high-capacity, low cost per gigabyte, and longevity. Magnetic tape is used primarily for archival purposes and data backup. Accessing data on tape is slower compared to disk drives but well-suited for infrequently accessed data.

Why is Memory Hierarchy used in systems?

The memory hierarchy is used in computer systems to optimize the usage of available memory resources. The hierarchy is composed of different levels of memory, each with varying speed, size, and cost. The lower levels, such as registers and caches, have faster access times but are limited in capacity and more expensive, while the higher levels, such as main memory and secondary storage, have larger capacities but are slower and less expensive. By storing frequently accessed data in faster and smaller memory levels and less frequently accessed data in slower but larger memory levels, memory hierarchy ensures efficient data access, reduces processing time, and enhances overall system performance.

Advantages of Memory Hierarchy  

  • Faster access: Due to multiple levels in the memory hierarchy, users get faster access to frequently used data. Cache memory, the fastest memory, stores the most frequently used data.
     
  • Cost-effective: Using the most expensive memory only where it is needed can help us reduce the cost. Cache memory is more expensive than main memory or secondary storage. With the help of memory hierarchy, it can be used only in necessary areas rather than using it everywhere.
     
  • Efficient use of resources: Computer resources can be used effectively by memory hierarchy, ensuring no waste of resources. For example, high-speed access to a particular data set that is not frequently used results in a waste of resources.
     
  • Increased capacity: A system can store large data in secondary storage devices such as Hard drives and SSD (solid-state drives) through memory hierarchy. On the other hand, the most frequently used data is stored inside the cache.
     
  • Increased processing speed: By memory hierarchy, operations can be performed much faster as the fastest memory can be used for the most frequently used data. The CPU can access the data in a faster manner, which in turn, increases the processing speed.

Frequently Asked Questions

What is memory hierarchy in computer?

The memory hierarchy is the arrangement of various types of storage on a computing system based on access speed. It organizes computer storage according to response time. The memory hierarchy levels are CPU registers, cache memory, main memory or primary memory, magnetic disks or secondary memory, and Optical disks or magnetic types or tertiary memory.

What is memory hierarchy and its types?

The memory hierarchy is the management and organization of computer's memory based on the speed, characteristics, and capacities. The primary types of memory hierarchy includes registers, cache, main memory (RAM), and secondary storage (hard drives, SSDs, etc.), tertiary storage.

What is memory hierarchy in ARM processor?

ARM (Advanced RISC Machines) processors are the processors that are used in smartphones, servers, and embedded systems. In them, the smaller and faster memory is close to the core on the other hand, larger and slower memory is much away. 

What are the 7 levels of computer hierarchy?

The computer hierarchy has seven levels. These seven layers are high-level language, system software, machine, assembly language, digital logic, control and user. 

Conclusion

This blog has extensively discussed the Design and Characteristics of Memory Hierarchy in a computer system. Our discussion mainly focused on how memory organization is done in our computer system? all the memory levels in detail, and the characteristics of the memory hierarchy.

We hope that this article helps you enhance your knowledge of Memory Hierarchy. To learn more about computer architecture, you may refer to our articles:

Do upvote our blog to help other ninjas grow.

Next article
Main Memory
Guided path
Free
gridgp-icon
Data structures & algorithms (Beginner to Intermediate)
13 chapters
109+ Problems
gp-badge
Earn badges and level up
Live masterclass