Memory

Overview

The memory hierarchy refers to the various storage devices used in a computer, arranged from expensive and fast to cheap and slow. A typical hierarchy looks like:

memory-hierarchy.png

Storage Devices

A storage device is called volatile if they lose their information when supply voltage is turned off. Nonvolatile memories retain their information even when powered off.

RAM

Random access memory (RAM) comes in two varieties - static and dynamic. SRAM is both faster and more expensive than DRAM.

Static

Static RAM (SRAM) is primarily used for cache memories. SRAM stores a bit in a bistable memory cell implemented as a six-transistor circuit. Provided it has power, it can stay indefinitely in either of two different voltage configurations, i.e. states.

Dynamic

Dynamic RAM (DRAM) is primarily used for main memory. DRAM stores a bit in a cell consisting of a capacitor and a single access transistor. DRAM also leaks - a cell loses its charge within a time period of around 10 to 100 milliseconds.

ROM

Read only memory (ROM) is the historical term used to describe nonvolatile memories. Note this is a misnomer - many ROMs can be written to. ROMs are distinguished by the number of times they can be written to and the mechanism used to write them. Some examples include:

Flash

Flash is a nonvolatile storage device based on EEPROMs.

Solid State Disks

A solid state disk (SSD) is based on flash memory. An SSD package consists of one or more flash memory chips and a flash translation layer responsible for translating requests for logical blocks into accesses of the underlying physical device.

Flash memory consists of a sequence of blocks, where each block consists of a number of pages. A page can only be written to after the entire block to which it belongs has been erased. Wear-leveling logic is used to maximize the lifetime of each block by spreading erasures evenly across all blocks.

Hard Disk Drives

Hard disk drives (HDDs) are constructed with one or more platters stacked on top of each other and encased in a sealed package. Each platter consists of two surfaces coated with magnetic recording material. A rotating spindle in the center of the platters rotates them at a fixed rotational rate.

Each surface consists of a collection of concentric rings called tracks. Each track is further partitioned into a collection of sectors, each of which contains an equal number of data bits. Sectors are separated by gaps where no data bits are stored; gaps store formatting bits used to identify sectors.

hdd.png

Metrics

There exist a few common metrics used to evaluate the capacity of an HDD:

To maximize areal density, multiple zone recording partitions the set of cylinders into disjoint subsets called recording zones. Each track in each cylinder in a zone has the same number of sectors, which is determined by the number of sectors in the innermost track of the zone.

Operation

Disks read and write bits stored on the magnetic surface using a read/write head connected to the end of an actuator arm. By moving the arm back and forth along its radial axias, the drive can position the head over any track on the surface (a mechanical motion known as a seek).

actuator-arm.png

There is one read/write head for each surface, all connected to a single arm. At any point in time, all heads are positioned on the same cylinder.

Disks read and write data in sector-size blocks. The access time for a sector has three main components:

Logical Disk Blocks

Modern disks hide their geometry, instead presenting to the OS a sequence of B sector-size logical blocks numbered 0, 1, , B1. A small hardware or firmware device in the disk package, called the disk controller maps logical block numbers to physical disk sectors by translating each logical block number to a surface,track,sector triple.

Powered by Forestry.md