Understand primary storage

Data Storage – Primary & Secondary Storage

1. What is Primary Storage?

Primary storage (also called main memory) is the part of a computer that holds data and instructions which the CPU must access rapidly while a program is running. It is directly addressable by the processor, is much faster than secondary storage, and is usually volatile.

2. Key Characteristics of Primary Storage

  • Volatility: Most primary memory (e.g., registers, cache, RAM) loses its contents when power is removed.
  • Speed: Access times are measured in nanoseconds (ns) – orders of magnitude faster than secondary storage.
  • Direct addressability: Every byte has a unique memory address that the CPU can use without any intermediate steps.
  • Limited capacity: From a few bytes in micro‑controllers to several gigabytes (GB) in modern PCs.

3. Types of Primary Storage

  1. Registers – tiny, ultra‑fast storage inside the CPU for operands and intermediate results.
  2. Cache memory – small, fast memory (L1, L2, L3) that holds copies of frequently used RAM data.
  3. Random‑Access Memory (RAM) – the main workspace for programs and data while they run.
  4. Read‑Only Memory (ROM) and its variants
    • ROM – permanently programmed during manufacture; non‑volatile.
    • PROM (Programmable ROM) – can be programmed once after manufacture.
    • EPROM (Erasable‑Programmable ROM) – can be erased with UV light and re‑programmed.
    • EEPROM (Electrically‑Erasable‑Programmable ROM) – can be erased and re‑programmed electrically.
    • Flash memory – a type of EEPROM used for BIOS/UEFI and solid‑state drives.

4. Memory Hierarchy (Fastest → Slowest)

Memory hierarchy pyramid: registers → cache → RAM → ROM → secondary storage
Typical memory hierarchy – the higher the level, the faster and more expensive per byte.

5. Addressing in Primary Memory

Primary memory is byte‑addressable: each individual byte has its own address. If a system has n address lines, the total number of addressable locations is:

Number of locations = 2n

Example 1 – 32‑bit address bus: 232 = 4 294 967 296 bytes ≈ 4 GB of RAM.

Example 2 – 24‑bit address bus (exam style): 224 = 16 777 216 bytes = 16 MiB of RAM.

6. Volatile vs Non‑volatile Primary Storage

Memory type Volatile? Typical use
Registers, Cache, RAM Yes – data is lost when power is removed Temporary storage of data being processed
ROM, PROM, EPROM, EEPROM, Flash No – retains data without power Firmware, BIOS/UEFI, permanent system code

7. Units of Storage (Binary Prefixes)

The IGCSE syllabus uses the binary (base‑2) definitions. All conversions are performed by repeatedly dividing or multiplying by 1 024.

  • 1 byte = 8 bits
  • 1 KiB (kibibyte) = 210 = 1 024 bytes
  • 1 MiB (mebibyte) = 220 = 1 024 KiB = 1 048 576 bytes
  • 1 GiB (gibibyte) = 230 = 1 024 MiB = 1 073 741 824 bytes

8. Primary vs Secondary Storage – Quick Comparison

Aspect Primary Storage Secondary Storage
Typical examples Registers, Cache, RAM, ROM (including PROM/EPROM/EEPROM/Flash) Hard‑disk drives (HDD), Solid‑state drives (SSD), Magnetic tape, Optical disc (CD/DVD), USB flash drive
Speed (access time) 0.5 ns – 100 ns 5 µs – 10 ms (HDD) / 0.1 µs – 1 µs (SSD)
Volatility Mostly volatile (RAM, cache, registers); some non‑volatile (ROM and its variants) Non‑volatile – retains data without power
Typical capacity KB – GB GB – TB (or more)
Cost per byte High Low
Purpose Fast workspace for the CPU while programs run Long‑term storage of files, programs, backups, archives

9. Virtual Memory – Bridging Primary & Secondary Storage

  • Virtual memory uses a reserved area of secondary storage (called swap space or page file) as an extension of RAM.
  • Memory is divided into fixed‑size blocks called pages (commonly 4 KB). When RAM becomes full, pages that are not currently needed are written to the swap space; needed pages are read back into RAM.
  • This paging process allows a computer to run programs that require more memory than the physical RAM provides, at the cost of slower access (disk speed vs RAM speed).
  • Key points for the exam:
    • Virtual memory = RAM + part of secondary storage.
    • Pages are moved between RAM and swap space (paging).
    • Purpose: prevent “out‑of‑memory” crashes and enable larger programs.

10. File‑Size Calculations (Exam‑style Examples)

Example A – Colour Image

Calculate the size of a 640 × 480 pixel colour image that uses 24‑bit colour (8 bits for each of red, green, blue).

  1. Number of pixels = 640 × 480 = 307 200.
  2. Bits per pixel = 24 bits.
  3. Total bits = 307 200 × 24 = 7 372 800 bits.
  4. Convert to bytes: 7 372 800 ÷ 8 = 921 600 bytes.
  5. Convert to KiB: 921 600 ÷ 1 024 ≈ 900 KiB.
  6. Convert to MiB: 900 ÷ 1 024 ≈ 0.88 MiB.

Uncompressed size ≈ 0.88 MiB (≈ 900 KiB).

Example B – Mono Audio Clip

Calculate the size of a 30‑second mono audio recording sampled at 44.1 kHz with 16‑bit resolution.

  1. Sample rate = 44 100 samples / second.
  2. Bits per sample = 16 bits.
  3. Total bits = 44 100 × 30 × 16 = 21 196 800 bits.
  4. Convert to bytes: 21 196 800 ÷ 8 = 2 649 600 bytes.
  5. Convert to KiB: 2 649 600 ÷ 1 024 ≈ 2 588 KiB.
  6. Convert to MiB: 2 588 ÷ 1 024 ≈ 2.53 MiB.

Uncompressed size ≈ 2.53 MiB (≈ 2 588 KiB).

11. Data Compression

Compression reduces the amount of storage required for a file.

  • Lossless compression – original data can be perfectly reconstructed (e.g., PNG, ZIP). Used where every bit matters, such as text, spreadsheets, or executable files.
  • Lossy compression – some data is permanently discarded to achieve higher compression ratios (e.g., JPEG for photos, MP3 for audio). Acceptable when a small loss of quality is not noticeable.

Exam‑style Question – Compression

Question: Identify whether each of the following file types uses lossless or lossy compression.

  1. JPEG image
  2. PNG image
  3. MP3 audio
  4. ZIP archive

Answer:

  • JPEG – lossy
  • PNG – lossless
  • MP3 – lossy
  • ZIP – lossless

12. Linking to IGCSE Assessment Objectives

Sub‑topic AO1 – Knowledge AO2 – Application AO3 – Evaluation (where relevant)
Definition & characteristics of primary storage Recall definition, volatility, speed, direct addressability, capacity limits. Explain why primary storage must be fast and volatile. Discuss trade‑offs between speed and cost.
Types of primary storage (registers, cache, RAM, ROM variants) Name each type and its main purpose. Identify which type would store a CPU operand vs. firmware. Evaluate advantages of using ROM vs. RAM for system code.
Memory hierarchy List the hierarchy in order (fastest → slowest). Explain how the hierarchy reduces overall access time. Assess the impact of adding an extra cache level.
Addressing & address‑bus calculations State the formula 2ⁿ and the meaning of byte‑addressable. Calculate maximum RAM for a given address‑bus width. Discuss why a 64‑bit address bus is needed for modern PCs.
Volatile vs non‑volatile primary storage Define volatility and give examples. Choose the appropriate memory type for a given scenario. Evaluate the consequences of power loss on volatile memory.
Binary units (KiB, MiB, GiB) Recall the 1 024‑based definitions. Convert between bytes, KiB, MiB, GiB. Explain why the exam uses binary prefixes instead of decimal.
Virtual memory Describe paging, swap space, and why it is needed. Illustrate how a page is moved from RAM to secondary storage. Evaluate the performance impact of excessive paging (thrashing).
File‑size calculations Recall the steps for converting pixels or samples to bytes. Perform calculations for image and audio file sizes. Assess how compression would change the calculated size.
Data compression Define lossless and lossy compression. Identify which method a given file type uses. Discuss when lossless vs. lossy compression is appropriate.

13. Key Take‑aways

  • Primary storage is fast, directly addressable memory used while programs run.
  • The memory hierarchy (registers → cache → RAM → ROM) balances speed, cost, and capacity.
  • Address‑bus width determines the maximum addressable memory (2ⁿ locations).
  • Binary prefixes (KiB, MiB, GiB) are essential for capacity and file‑size calculations.
  • Virtual memory links primary and secondary storage through paging and swap space.
  • Compression (lossless vs. lossy) lets large files be stored more efficiently; know the typical examples.
  • All sub‑topics map directly to IGCSE assessment objectives (AO1, AO2, AO3), aiding both teaching and exam preparation.

Create an account or Login to take a Quiz

42 views
0 improvement suggestions

Log in to suggest improvements to this note.