1.5 Memory (Primary and Secondary)

Learning Objectives

  • Understand the function and importance of memory in a computer system
  • Learn about different units of memory measurement
  • Compare and contrast primary and secondary memory
  • Identify different types of memory and their characteristics

1.5.1 Definition and Function of Memory

Memory is the storage unit of a computer used to store data, instructions, and information either temporarily or permanently. It enables the CPU to process and retrieve data whenever required.

Functions of Memory

  • Storage of Data and Instructions – Holds data and program instructions temporarily (RAM) or permanently (ROM/secondary memory).
  • Supply to CPU – Provides data and instructions to the CPU during processing.
  • Store Intermediate Results – Saves temporary results generated during processing.
  • Store Final Output – Keeps processed results for future use.
  • Booting Support – ROM stores essential programs (BIOS/firmware) required to start the computer.

1.5.2 Units of Memory Measurement

Computer memory and storage are measured in bits and bytes.

  • Bit (b): The smallest unit of memory, stores either 0 or 1.
  • Nibble: A group of 4 bits.
  • Byte (B): A group of 8 bits, represents one character (e.g., a letter/number).

Hierarchy of Memory Units:

1 Byte (B) = 8 bits
1 Kilobyte (KB) = 1024 Bytes
1 Megabyte (MB) = 1024 KB
1 Gigabyte (GB) = 1024 MB
1 Terabyte (TB) = 1024 GB
1 Petabyte (PB) = 1024 TB
1 Exabyte (EB) = 1024 PB

1.5.3 Types of Memory: Primary and Secondary Memory

The overall classification of computers can be done in two types:

  • Primary memory
  • Secondary memory

Primary Memory (Main Memory / Internal Memory)

Primary memory is the main/internal memory of a computer that is directly accessible by the CPU. It temporarily stores data and instructions while the computer is running.

RAM is called volatile memory because all the data stored in it is erased when the power supply is turned off.

RAM is called Random Access Memory because the CPU can read and write data from any physical location directly and quickly, without following a fixed order (sequential path).

Types of Primary Memory

  • RAM (Random Access Memory)
  • ROM (Read Only Memory)

Secondary Memory (Storage Devices)

Storage devices, also called secondary memory / auxiliary memory / backup memory, are used to store data and instructions permanently for future use. Unlike primary memory, they retain data even when the power is turned off.

Comparison between Primary and Secondary Memory

Primary Memory Secondary Memory
Considered as the main memory of a computer system Also known as auxiliary or backup memory
Faster than secondary memory Slower than primary memory
More expensive Less expensive
Examples: RAM, ROM, Cache Examples: Pen drive, CD, Hard Disk

1.5.4 Example of Primary Memory: RAM, ROM, Cache, Register

RAM (Random Access Memory)

RAM is the volatile / short-term memory of a computer system that temporarily stores data and instructions during processing.

Static RAM (SRAM)

SRAM is a type of volatile memory made of transistors which does not require periodic refreshing to hold data. SRAM is faster than DRAM but is more expensive and has a smaller storage capacity. It is mainly used as cache memory in computers.

Dynamic RAM (DRAM)

DRAM is a type of volatile memory made of capacitors which requires periodic refreshing to hold data. DRAM is slower than SRAM but is cheaper and has a larger storage capacity. It is widely used as the main memory in personal computers.

ROM (Read Only Memory)

ROM is a type of non-volatile primary memory that permanently stores data and instructions which can only be read and not easily modified. The contents of ROM remain safe even when the power supply is turned off. The data and instructions are written during manufacturing and are mainly used to store the BIOS (Basic Input Output System), which is essential for booting the computer. Programs stored in ROM are called firmware.

Types of ROM:

PROM (Programmable ROM)

PROM is a type of non-volatile memory that is initially blank at the time of manufacturing and can be programmed only once using a device called a PROM programmer (PROM burner). Once data is written, it becomes permanent and cannot be erased or modified.

EPROM (Erasable PROM)

EPROM is a type of non-volatile memory that can be erased and reprogrammed multiple times. To erase the stored data, it requires exposure to ultraviolet (UV) light. After erasing, new data can be written again.

EEPROM (Electrically Erasable PROM)

EEPROM is a type of non-volatile memory that can be erased and reprogrammed electronically using electrical signals within milliseconds. Unlike EPROM, it does not require UV light or special equipment.

Cache Memory

Cache memory is a high-speed volatile memory located between the CPU and RAM. It stores frequently used data and instructions so that the CPU can access them quickly, making processing faster.

CPU Register

A CPU register is a very small and high-speed storage location inside the microprocessor. It stores data, addresses, and instructions that the CPU needs immediately during processing.

1.5.5 Example of Secondary Memory (Storage Devices)

Hard Disk Drive (HDD)

A hard disk is a popular secondary storage device that stores a very large amount of data permanently. It consists of circular platters made of aluminum coated with a magnetic material, which rotate at high speed while data is written or read. The speed of a hard disk is measured in Revolutions Per Minute (RPM), which usually ranges from 5400 to 7200 rpm in common computers.

SSD (Solid State Drive)

An SSD is a modern secondary storage device that stores data using semiconductor chips instead of rotating platters. It provides faster read/write speeds, lower latency, and better reliability compared to hard disks. Although more expensive, SSDs are widely used in laptops, notebooks, and ultrabooks for high performance.

Optical Storage Discs

An optical storage disc is a secondary storage device that uses laser light technology to store and retrieve data. Common examples include CDs, DVDs, and Blu-ray Discs.

CD (Compact Disc)

A CD is an optical storage disc developed by Philips Company (Netherlands) in 1980. It uses laser ray technology to store and read data in the form of pits (tiny reflective bumps). A standard CD is 12 cm in diameter, 1 mm thick, and weighs about 18 g. The storage capacity of CD is 700MB.

DVD (Digital Versatile Disc)

A DVD is an optical storage disc with higher storage capacity than CDs because it stores data in multiple layers. A DVD drive is required to read and write data on DVDs.

Storage Capacities:

  • Single Side, Single Layer: 4.7 GB
  • Single Side, Double Layer: 8.5 GB
  • Double Side, Single Layer: 9.4 GB
  • Double Side, Double Layer: 17.08 GB

Difference between CD and DVD

CD DVD
Storage capacity is 700MB Storage capacity is up to 20GB
Cheaper More expensive
Types: CD-R, CD-RW, etc. Types: DVD-RW, DVD+RW, etc.

Flash Memory

Flash memory is a type of non-volatile storage that can be electrically erased and reprogrammed. It is widely used in USB drives, memory cards, SSDs, and other portable storage devices. Flash memory retains data even when the power is switched off.

Pen Drive (USB Flash Drive)

A pen drive is a portable storage device that uses flash memory (non-volatile) to store and transfer data between computers and digital devices. It connects to a computer via a USB (Universal Serial Bus) port and retains data even when power is turned off.

Cloud Storage

Cloud storage is a type of online data storage where files are stored on remote servers accessed through the Internet. It allows users to upload, access, and manage data from anywhere and on any device with an internet connection. Examples: Google Drive, Dropbox, Microsoft OneDrive, Amazon S3

Compare HDD vs SSD vs Flash Memory

Feature HDD SSD Flash Memory
Storage Technology Uses mechanical parts with spinning disks and read/write heads Uses flash memory chips with no moving parts Non-volatile memory using flash technology, typically in small form factors
Speed Slower read/write speeds due to mechanical parts Faster read/write speeds with no moving parts Fast, but typically slower than SSDs for large-scale data storage
Capacity Available in larger capacities (up to several TBs) Available in smaller to moderate capacities (typically up to several TBs) Typically smaller capacity (e.g., 1GB to 1TB, depending on the device)
Size/Weight Larger and heavier Smaller, lighter, and more compact Very small and lightweight, often used in portable devices

1.5.6 Function and Characteristics of Each Type of Memory

Registers

  • Function: Hold data being processed by CPU
  • Characteristics: Fastest, most expensive, limited capacity
  • Speed: 1-3 ns
  • Volatility: Volatile

Cache Memory

  • Function: Store frequently used data for quick access
  • Characteristics: Very fast, expensive, small capacity
  • Speed: 5-10 ns
  • Volatility: Volatile

RAM

  • Function: Temporary storage for running programs
  • Characteristics: Fast, moderate cost, medium capacity
  • Speed: 50-100 ns
  • Volatility: Volatile

HDD/SSD

  • Function: Long-term data storage
  • Characteristics: High capacity, slower than primary memory
  • Speed: 5-10 ms (HDD), 50-150 μs (SSD)
  • Volatility: Non-volatile

Interactive Activity

Match the memory type with its correct description:

Volatile memory that stores currently running programs and data
Non-volatile memory that stores firmware/BIOS
Very fast memory that reduces CPU-memory access time
Solid state storage with no moving parts
RAM
ROM
Cache
SSD

Summary

  • Memory is essential for storing data and instructions that the CPU needs to access quickly.
  • Primary memory (RAM, ROM, Cache, Registers) is faster but more expensive and volatile (except ROM).
  • Secondary memory (HDD, SSD, Optical, Flash) provides larger, non-volatile storage but is slower.
  • Memory is measured in bits and bytes, with common units being KB, MB, GB, and TB.
  • Different types of memory serve different purposes in a computer system, from ultra-fast registers to high-capacity hard drives.