# Secondary Storage Technologies

- **Track:** Cambridge IGCSE™ Computer Science (0478 / 0984) (CAMBRIDGE IGCSE 0478)
- **Module:** Section 3: Hardware & Architecture
- **Estimated Duration:** 15 minutes
- **Access:** Open Theory (All-Access for Interactive IDE &amp; Autotests)

---

## Theory & Conceptual Background

Primary memory (RAM) is volatile; its contents vanish the moment electrical power is turned off. To retain user documents, software programs, and the operating system permanently, computers require **secondary storage**.

---

## Learning Objectives

- Explain why secondary storage is necessary in computer systems.
- Compare the operational mechanics, capacity, durability, portability, and speed of **Magnetic**, **Optical**, and **Solid-State** storage.
- Describe the structure and benefits of **Cloud Storage**.

---

## 1. Magnetic Storage: Hard Disk Drives (HDD)

For decades, the **Hard Disk Drive (HDD)** has been the standard high-capacity non-volatile storage device for personal computers and enterprise servers.

```text
Actuator Arm & Read/Write Head
            \
             \__ [Head]
                 ======  <-- Spinning Magnetic Platters
                 ======      (Concentric Tracks & Sectors)
                   ||
                 Spindle Motor
```

### How an HDD Works:

- **Platters**: One or more circular aluminium or glass platters coated with a microscopic layer of magnetic iron oxide material, spinning at high speed (typically $5,400\text{ to }7,200\text{ RPM}$).
- **Read/Write Heads**: Electromagnets mounted on an actuator arm float on a microscopic cushion of air mere nanometres above the spinning surface.
- **Data Encoding**:
- The platters are formatted into concentric circles called **tracks**, which are subdivided into wedge-shaped **sectors**.
- To write data, the read/write head alters the magnetic polarity of iron oxide particles (North/South orientation represents binary `1` and `0`).
- To read data, the head detects magnetic flux reversals as particles fly past underneath.
- **Advantages**: Inexpensive; provides massive storage capacities (up to 20+ Terabytes) at the lowest cost per gigabyte.
- **Disadvantages**:
- **Mechanical Latency**: Access times are slow because the head must physically move across tracks (**seek time**) and wait for the platter to rotate under the head (**rotational latency**).
- **Fragility**: High risk of a **head crash** (where the head physically scrapes the platter, causing permanent data loss) if dropped, bumped, or subjected to vibration.
- Generates heat, noise, and consumes significant electrical power.

---

## 2. Optical Storage: CD, DVD & Blu-Ray

Optical media store data on removable polycarbonate discs that are read using concentrated beams of laser light.

```text
Laser Diode ---> [ Lens ] ---> Polycarbonate Disc
                                 |___|~~~|___|~~~|
                                 Pits & Lands
```

### How Optical Discs Work:

- The disc surface contains a single, continuous spiral track of microscopic depressions called **pits**, separated by flat reflective areas called **lands**.
- A laser beam shines onto the spinning disc as a photodiode sensor measures the reflected light:
- When the laser shines on a flat **land**, light reflects cleanly straight back into the sensor.
- When the laser hits the edge of a **pit**, light scatters and reflects weakly.
- The transitions between pits and lands are converted into binary pulses ($0$s and $1$s).

### Comparison Across Optical Formats:

  
| Optical Format | Laser Type & Wavelength | Track Pitch & Pit Size | Typical Capacity | Primary Applications |
| --- | --- | --- | --- | --- |
| **Compact Disc (CD)** | Infrared laser ($780\text{ nm}$) | Widest track spacing ($1.6\text{ }\mu\text{m}$) | $\sim 700\text{ MiB}$ | Audio albums, legacy software installers. |
| **Digital Versatile Disc (DVD)** | Red laser ($650\text{ nm}$) | Tighter track spacing ($0.74\text{ }\mu\text{m}$) | $\sim 4.7\text{ GB}$ (single-layer) | Standard definition movies, software distribution. |
| **Blu-Ray Disc (BD)** | Blue-violet laser ($405\text{ nm}$) | Extremely tight spacing ($0.32\text{ }\mu\text{m}$) | $\sim 25\text{ GB}$ (single-layer) | 4K / High Definition video, console gaming discs. |

> [!NOTE]
> **Why Blu-Ray Stores More Data**: Blue-violet light has a much shorter wavelength ($405\text{ nm}$) than red light ($650\text{ nm}$). This allows the laser to be focused into a much smaller, sharper beam spot, enabling the disc to pack microscopic pits and tracks far closer together.

---

## 3. Solid-State Storage: Flash Memory (SSD)

**Solid-State Drives (SSDs)**, USB flash thumb drives, and SD memory cards use semiconductor flash memory to store digital data.

### How Solid-State Flash Works:

- Built from millions of **NAND flash memory cells**.
- Each cell contains specialized transistors called **Floating-Gate Transistors** (or charge trap cells) sandwiched between two insulating oxide layers.
- When a high voltage is applied, electrons are pushed across the insulating barrier into the floating gate (**Fowler-Nordheim tunneling**).
- Once inside, stored charge can retain data without power for years, but retention is finite and depends on device condition and storage conditions.

### Advantages of SSDs over HDDs:

1. **No Moving Parts**: More resistant to mechanical shock and vibration than an HDD, but still vulnerable to physical damage; operates completely silently.
2. **Instantaneous Access Times**: No seek time or rotational latency; files load in fractions of a millisecond.
3. **High Data Transfer Rates**: NVMe PCIe SSDs achieve read speeds in excess of $7,000\text{ MB/s}$ (compared to $\sim 150\text{ MB/s}$ on an HDD).
4. **Energy Efficient**: Consumes significantly less power and generates less heat, extending laptop battery life.

### Disadvantages of SSDs:

1. **Cost per Gigabyte**: More expensive per GiB of capacity than mechanical hard disks.
2. **Limited Write Endurance**: Each erase cycle causes microscopic degradation of the oxide insulator layer. Solid-state controllers use **wear leveling** algorithms to distribute writes evenly across all blocks, but cells eventually exhaust their write endurance after tens of thousands of write cycles.

---

## Written practice and self-review

A field scientist requires a rugged laptop computer to record data while travelling on rough off-road terrain in remote wildlife habitats.

1. State **two distinct technical advantages** of equipping the laptop with a **Solid-State Drive (SSD)** rather than a traditional **Hard Disk Drive (HDD)** for this specific environment.
2. State **one potential drawback** of selecting an SSD compared to an HDD.

Write an explanation before checking the theory. Check that each claim answers the question, uses the correct concept and explains why it applies. Discuss uncertain points with a teacher. The structured exercise below checks specific facts; it does not automatically mark this explanation.

---

## Interactive Exercises & Autotest Specifications

### Exercise 1: Exam-Style Check: Solid-State Flash Operation (Multiple choice, 25 XP)

**Instructions:**
Which secondary storage technology relies on arrays of floating-gate transistors with no moving mechanical components?

**Options:**
- **A**: Magnetic Hard Disk Drive (HDD)
- **B**: Optical Blu-Ray Disc
- **C**: Dynamic Random Access Memory (DRAM)
- **D**: Solid-State Storage (SSD / Flash memory)


**Autotest Expectations:**
- **Correct option selected**: `selection_match` -> Expected: `b`

### Exercise 2: Exam-Style Question: Calculate Secondary Storage Capacities (Fill in blank, 35 XP)

**Instructions:**
A photographer stores high-resolution photographs on a solid-state drive.

1. Each photograph has a file size of 4 MiB. Calculate the size of one photograph in KiB (1 MiB = 1024 KiB): [blank_1] KiB.
2. Calculate how many 4 MiB photographs can be stored on a 2 GiB memory card (assume 1 GiB = 1024 MiB): [blank_2] photographs.
3. If the photographer compresses each image to 1 MiB, calculate how many photographs can now fit on the 2 GiB card: [blank_3] photographs.


**Starter Code:**
```text
{"prompt":"Complete the storage calculations:","template":"1. 4 MiB in KiB: [blank_1]\n2. Number of 4 MiB photos on 2 GiB card: [blank_2]\n3. Number of 1 MiB photos on 2 GiB card: [blank_3]","word_bank":["4096","512","2048","1024","256","4000","500"],"blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}]}
```

**Autotest Expectations:**
- **4 MiB is 4096 KiB**: `text_exact` -> Expected: `4096`
- **512 photos fit on 2 GiB**: `text_exact` -> Expected: `512`
- **2048 photos fit on 2 GiB after compression**: `text_exact` -> Expected: `2048`

### Exercise 3: Application: Check the reasoning (Fill in blank, 30 XP)

**Instructions:**
Work out each answer before submitting. Which technology uses magnetic platters: HDD or SSD? Which technology reads disc surfaces with a laser? Which has no moving read/write head: HDD or SSD?


**Starter Code:**
```text
{"prompt":"Application: Check the reasoning","template":"1. Which technology uses magnetic platters: HDD or SSD? [blank_1]\n2. Which technology reads disc surfaces with a laser? [blank_2]\n3. Which has no moving read/write head: HDD or SSD? [blank_3]","blanks":[{"id":"blank_1"},{"id":"blank_2"},{"id":"blank_3"}],"word_bank":["HDD","SSD","optical","magnetic tape","flash memory"]}
```


