M1-R5.1 · Unit 1 · Introduction to Computer

Computer Memory & Storage

Understand the complete memory hierarchy — from lightning-fast CPU registers and cache to RAM, ROM, SSDs, and cloud storage.

1. Understanding Computer Memory

Computer memory refers to the physical devices used to store data, programs (instructions), and results for either immediate or later use. It is a fundamental component of any computer system, acting much like the human brain by retaining information that the Central Processing Unit (CPU) needs to perform tasks.

Memory operates on binary data, representing everything as a series of 0s and 1s. To measure memory capacity, we use specific units:

Basic Units of Memory Measurement
  • Bit: Binary Digit (0 or 1), the smallest unit of data.
  • Nibble: A group of 4 bits.
  • Byte: A group of 8 bits (often the fundamental unit of storage).
  • Kilobyte (KB): 1024 Bytes.
  • Megabyte (MB): 1024 KB.
  • Gigabyte (GB): 1024 MB.
  • Terabyte (TB): 1024 GB.
  • Petabyte (PB): 1024 TB.

2. Memory Hierarchy

The memory hierarchy is a pyramid-like structure that organizes different types of memory based on three key factors: Speed, Capacity, and Cost. As you move up the hierarchy, the memory becomes faster and more expensive per byte, but lower in capacity. Conversely, moving down increases capacity and decreases cost, but results in slower access speeds.

Pyramid Breakdown (Top to Bottom): Registers → Cache → Main Memory (RAM) → Secondary Storage (HDD/SSD) → Auxiliary / Tape Storage.
Registers (CPU)
Fastest, built into CPU, tiny capacity (Bytes)
Cache Memory
Extremely fast, near CPU, small capacity (MB)
Main Memory (RAM)
Fast, directly accessed by CPU, medium capacity (GB)
Secondary Storage
Slower, permanent storage, massive capacity (TB)

3. Primary Memory (Main Memory)

Primary memory is the area in a computer where data and instructions required for immediate processing are stored. It is directly accessible by the CPU via the memory bus. The two main types of primary memory are RAM and ROM.

a) RAM (Random Access Memory)

RAM is the working memory of the computer. When you open a program, it loads into RAM for fast execution. It is known as a volatile memory, meaning all stored data is wiped out the moment the power is turned off.

  • SRAM (Static RAM): Uses flip-flop circuitry to hold data. It is faster, more expensive, and consumes more power. It is primarily used for Cache memory.
  • DRAM (Dynamic RAM): Uses capacitors and transistors. It must be continuously refreshed to retain data. It is cheaper, has higher density, and is used as the system's main memory (e.g., DDR3, DDR4, DDR5).

b) ROM (Read-Only Memory)

ROM is non-volatile memory, meaning it retains its contents even without a power supply. It is mainly used to store firmware—crucial instructions required to boot up the computer, such as the BIOS (Basic Input/Output System) or UEFI.

  • PROM (Programmable ROM): Can be programmed only once by the user. Once written, the data is permanent.
  • EPROM (Erasable Programmable ROM): Can be erased by exposing the chip to strong Ultraviolet (UV) light for a specific duration, then reprogrammed.
  • EEPROM (Electrically Erasable Programmable ROM): Can be erased and rewritten electrically without removing it from the computer. Flash memory (used in USB drives and SSDs) is a specialized type of EEPROM.

4. Cache Memory

Cache memory is an extremely fast memory type that acts as a buffer between the RAM and the CPU. It holds frequently requested data and instructions so that they are immediately available to the CPU when needed, significantly improving system performance.

  • L1 Cache (Level 1): Built directly into the CPU core. Very small (few KBs) but incredibly fast.
  • L2 Cache (Level 2): Slower than L1 but larger (few MBs). May be built into the CPU or on a separate chip very close to it.
  • L3 Cache (Level 3): Shared among all cores of a multi-core processor. Larger in size but slower than L2.
Cache Hit vs Cache Miss: A Cache Hit occurs when the CPU finds the required data in the cache. A Cache Miss occurs when the data is not found in the cache, forcing the CPU to fetch it from the slower RAM.

5. Secondary Storage (Mass Storage)

Since primary memory is expensive and volatile, computers rely on secondary storage for long-term, non-volatile data retention. It holds the operating system, applications, and user files permanently.

Magnetic Storage

Uses magnetic patterns to represent data.

  • Hard Disk Drive (HDD): Consists of spinning magnetic platters. Data is written in concentric circles called tracks, which are divided into sectors. Read/write heads float just above the surface to access data.
  • Magnetic Tape: A sequential access storage medium used primarily for long-term archival and enterprise backups.

Solid State Storage

Uses flash memory chips to store data electronically. It has no moving parts, making it extremely fast, quiet, and durable.

  • Solid State Drive (SSD): The modern replacement for HDDs, offering drastically faster boot times and file transfers.
  • Pen Drives / USB Flash Drives: Portable, plug-and-play storage devices connecting via USB ports.
  • Memory Cards (SD/microSD): Tiny storage chips used in cameras, smartphones, and tablets.

Optical Storage

Uses lasers to read and write data on a reflective disc surface in the form of microscopic pits and lands.

  • CD (Compact Disc): Typical capacity is 700 MB. Includes CD-ROM (Read-Only), CD-R (Recordable once), CD-RW (Rewritable).
  • DVD (Digital Versatile Disc): Typical capacity ranges from 4.7 GB (Single-layer) to 8.5 GB (Dual-layer).
  • Blu-ray Disc (BD): Uses a blue-violet laser allowing high-density storage from 25 GB to 50 GB or more, ideal for HD movies and large games.

6. Comparison Tables

Table 1: RAM vs ROM

Feature RAM (Random Access Memory) ROM (Read-Only Memory)
Volatility Volatile (loses data on power off) Non-volatile (retains data without power)
Operation Read and Write operations supported Generally Read-only (writing is slow/complex)
Speed Very Fast Slower than RAM
Cost High cost per MB Lower cost per MB
Capacity Usually higher (4GB to 64GB+ in PCs) Usually lower (few MBs for firmware)
Usage Holds active programs, OS kernel, working data Holds BIOS/UEFI, firmware, boot instructions
CPU Access Directly accessed by the CPU Directly accessed (during boot)
Types SRAM, DRAM PROM, EPROM, EEPROM

Table 2: Primary Memory vs Secondary Memory

Feature Primary Memory Secondary Memory
Access Directly accessible by CPU Not directly accessible by CPU (goes via RAM)
Nature Usually Volatile (except ROM) Always Non-volatile
Speed Faster (semiconductor memories) Slower (magnetic/optical/flash drives)
Cost More expensive per unit Cheaper per unit

Table 3: HDD vs SSD

Feature HDD (Hard Disk Drive) SSD (Solid State Drive)
Technology Magnetic platters and moving heads NAND flash memory (no moving parts)
Speed Slower read/write speeds (approx 100-150 MB/s) Very Fast (approx 500 MB/s to 7000+ MB/s)
Durability Fragile (moving parts can break if dropped) Highly durable and shock-resistant
Noise & Power Generates noise and uses more power Silent operation and power-efficient
Price Cheaper for large capacities More expensive per GB

7. Storage Units Chart

Unit Equivalent To Power of 2
BitBinary 0 or 1-
Nibble4 Bits-
Byte (B)8 Bits20
Kilobyte (KB)1024 Bytes210
Megabyte (MB)1024 KB220
Gigabyte (GB)1024 MB230
Terabyte (TB)1024 GB240
Petabyte (PB)1024 TB250
Exabyte (EB)1024 PB260
Zettabyte (ZB)1024 EB270
Yottabyte (YB)1024 ZB280

8. Key Exam Points for O Level M1

Revision Checklist
  • SRAM vs DRAM: SRAM uses flip-flops and is faster (used in cache). DRAM uses capacitors and must be refreshed constantly.
  • BIOS location: BIOS is a firmware program stored on a ROM chip.
  • EEPROM: Stands for Electrically Erasable Programmable Read-Only Memory. Flash drives use EEPROM technology.
  • Registers: The absolute fastest and smallest memory type, located directly inside the CPU.
  • Volatility: RAM is volatile; ROM, HDD, SSD, and Optical discs are non-volatile.