Memory Hierarchy

CSC443

1. Memory Hierarchy

Memory is categorized into volatile and nonvolatile memories, with the former requiring constant power ON of the system to maintain data storage.

Furthermore, a typical computer system provides a hierarchy of different times of memories for data storage.


Different levels of the memory hierarchy

  1. Cache (MB): Cache is the fastest accessible memory of a computer system. It's access speed is in the order of a few nanoseconds. It is volatile and expensive, so the typical cache size is in the order of megabytes.

  2. Main memory (GB): Main memory is arguably the most used memory. When discussing computer algorithms such as quick sort, balanced binary sorted trees, or fast Fourier transform, one typically assumes that the algorithm operates on data stored in the main memory. The main memory is reasonably fast, with access speed around 100 nanoseconds. It also offers larger capacity at a lower cost. Typical main memory is in the order of 10 GB. However, the main memory is volatile.

  3. Secondary storage (TB): Secondary storage refers to nonvolatile data storage units that are external to the computer system. Hard drives and solid state drives are examples of secondary storage. They offer very large storage capacity in the order of terabytes at very low cost. Therefore, database servers typically have an array of secondary storage devices with data stored distributedly and redundantly across these devices. Despite the continuous improvements in access speed of hard drives, secondary storage devices are several magnitudes slower than main memory. Modern hard drives have access speed in the order of a few milliseconds.

  4. Tertiary storage (PB): Teriary storage refers storage designed for the purpose data backup. Examples of tertiary storage devices are tape drives are robotic driven disk arrays. They are capable of petabyte range storage, but have very slow access speed with data access latency in seconds or minutes.

In this course, we are mainly concerned with the main memory and the secondary storage of the memory hierarchy.

2. Data movement

In order to perform computation, data must travel from the secondary storage to the CPU. Due to the vast differences in access speed and storage capacity, the operating system performs a series of sophisticated steps (both at the levels of hardware and the software).

2.1. Move data to and from secondary storage

The hard drive has a local data cache. Because the hard drive access speed is so much slower, disk access are normally done asynchronously at the hardware level. The hard drive will be instructed to fetch or save data from a physical location of a certain size. The hard drive controller will acknowledge the instruction right away, and will take sometime to populate the disk cache with the requested data block, and then, at a later time, raise an interrupt to notify the interested party that the data access is complete. This model of interrupt based data transfer is asynchronous.

The data transfer speed (from memory to hard drive or vice versa) depends on:

  1. contiguousness of the accessed physical locations on the disk
  2. the size of the accessed data per request

2.2. Performance characteristics

The mechanical design of the hard drive naturally leds itself to superior sequential access.

A hard drive consists of an (array of) rotating disk. Each disk has a head driven by a mechanical arm which performs the bitwise read and write. If a sequential data block is accessed, all bits can be read or written during a single rotation.

However, random access of the hard drive data may require multiple rotations for the head to reach all the regions on the disk.


Seek time is measures average time it takes the head to travel to the region of interest on disk. Typically, the seek time is a few milliseconds.

Roational speed (rpm) Seek time (ms)
15,000 2
10,000 3
7,200 4.16

Source: wikipedia pin

Data transfer rate is the steady state speed the head can read or write data between the disk buffer and the disk. The data tranfer rate can reach 1 terabites / second.

References