3.3 Data storage

Primary Memory

Primary memory refers to the components that the CPU can access directly and quickly. It is essential for the immediate execution of instructions and the functioning of the OS.

Volatile

RAM (Random Access Memory)

Temporary workspace for the computer. It stores the data and programs currently in use by the CPU.

  • Function: Holds the OS, open applications, and GUI.
  • Nature: Contents are lost when power is turned off.
  • Speed: Extremely fast compared to secondary storage.
Non-Volatile

ROM (Read Only Memory)

Non-volatile memory holding the instructions the computer needs before any software has loaded. Some types are permanent; others can be reprogrammed, as the next section explains.

  • Function: Stores the BIOS (Basic Input/Output System) or Bootstrap Loader.
  • Nature: Retains data even without power.
  • Access: Not written to during normal running — unlike RAM, which is written to constantly.

Types of RAM: SRAM and DRAM

RAM comes in two forms, and the difference between them is what each one is physically made of — which then explains every other difference.

FeatureDRAM (Dynamic RAM)SRAM (Static RAM)
Built fromA capacitor and a transistor per bitSeveral transistors per bit (a flip-flop)
RefreshingMust be constantly refreshed — the capacitor's charge leaks awayNever needs refreshing — holds its value while powered
SpeedSlowerFaster
CostCheaper per bitMore expensive per bit
DensityHigher — more bits fit in the same spaceLower — each bit takes more room
Power useHigher, because of the constant refreshingLower
Used forMain memory (the RAM sticks in a computer)Cache memory inside the CPU
Why each is used where it is. Main memory needs to be large and affordable, so DRAM's low cost and high density win even though it is slower. Cache needs to be as fast as possible and is only a few megabytes, so SRAM's speed is worth its cost and size. Both are volatile — the difference is refreshing, not permanence.

Types of ROM: PROM, EPROM and EEPROM

ROM also comes in several forms, and they form a ladder: each step up can be rewritten more easily than the one before.

TypeCan it be written?How
ROMNeverContents are fixed when the chip is manufactured.
PROM
Programmable
Once onlyWritten once by the purchaser using a special device. After that it is permanent.
EPROM
Erasable Programmable
Many timesErased by exposing the chip to ultraviolet light through a window in its case, then rewritten. The whole chip is erased at once, and it must be removed from the circuit to do it.
EEPROM
Electrically Erasable Programmable
Many timesErased and rewritten electrically, in place, without removing the chip — and selected bytes can be changed rather than the whole chip.
The distinction examiners test is between EPROM and EEPROM, because the names are nearly identical. The extra E is electrically. EPROM needs ultraviolet light and the chip has to come out of the machine; EEPROM is rewritten by electrical signals with the chip still in place. That is why EEPROM is what modern computers use for the BIOS — it is what makes a firmware update possible without opening the case.

Memory vs. Storage: The Key Differences

In IGCSE Computer Science, it is crucial not to use the terms "memory" and "storage" interchangeably. They serve two distinct roles in the Von Neumann architecture.

Feature Primary Memory (RAM) Secondary Storage (HDD/SSD)
Direct CPU Access Yes. The CPU fetches instructions directly from here. No. Data must be moved to RAM before the CPU can use it.
Volatility Volatile (Temporary). Non-volatile (Permanent).
Capacity Lower (typically 8GB - 32GB). Much higher (typically 256GB - 4TB+).
Relative Speed Very High speed. Relatively Slow speed.

The Need for Each

Why we need Primary Memory (RAM):

The CPU is incredibly fast. If it had to wait for a mechanical Hard Drive or even a Solid State Drive to fetch every bit of data, the computer would crawl to a halt. RAM acts as a high-speed buffer that keeps the CPU supplied with data at the speeds it requires.

Why we need Secondary Storage:

Because RAM is volatile, we need a way to keep our files (documents, photos, games) when the computer is switched off. Secondary storage provides permanence and high-capacity space for data that isn't currently being processed.

Exam Tip: If you are asked why a computer needs both, remember: RAM provides speed and direct access, while Storage provides non-volatile capacity.

Secondary Storage

Secondary storage is non-volatile memory used to store data and programs permanently. Unlike RAM, it does not lose its contents when power is removed.

1. Magnetic Storage (HDD)

Hard Disk Drives (HDDs) use magnetic properties to store data on rapidly rotating disks called platters.

How it works:
  • Data is stored on magnetic platters that spin at high speeds (e.g., 7200 RPM).
  • A read/write head sits on an actuator arm and moves across the surface of the platter.
  • The surface is divided into tracks and sectors.
  • The head changes the magnetic polarity of particles on the surface to represent binary 1s and 0s.

2. Optical Storage

Optical storage uses lasers to read and write data on the surface of a disk.

Mechanism:

  • A high-powered laser burns "pits" into the reflective surface of the disk; the flat areas are called "lands."
  • To read data, a low-powered laser shines on the surface.
  • Lands reflect light back to a sensor (binary 1), while Pits scatter the light (binary 0).

Common Types: CD (700MB), DVD (4.7GB), and Blu-ray (25GB+). Blu-ray has higher capacity because it uses a blue laser with a shorter wavelength, allowing for smaller, more densely packed pits.

3. Solid State Storage (Flash Memory)

Flash memory is electronic, non-volatile storage with no moving parts. It is used in SSDs, USB sticks, and SD cards.

How it works:
  • Uses a grid of floating-gate transistors.
  • Electrical charges are trapped within these gates.
  • The presence of a charge (or lack thereof) determines the bit value.

Static vs. Dynamic Flash Technology

While both are non-volatile, they differ in architecture and how they access data:

Feature Static Flash (NOR) Dynamic Flash (NAND)
Data Access Allows "Random Access" (can read individual bytes). Accesses data in "Blocks" or pages.
Read Speed Very fast reading. Fast reading, but slower than NOR for small data.
Write/Erase Speed Slower writing and erasing. Much faster at writing and erasing large amounts of data.
Storage Density Low (Expensive per GB). High (Cheaper per GB).
Typical Use Storing Firmware or BIOS (where code needs to be executed directly). Mainstream storage (SSDs, USB Drives, Smartphones).

Virtual Memory

Virtual Memory is a feature of an operating system that allows a computer to compensate for shortages of physical RAM by temporarily transferring data from random access memory (RAM) to disk storage.

The Reason for Virtual Memory

When you try to run more applications than your physical RAM can hold, the computer would normally crash or refuse to open new programs. Virtual Memory prevents this by using a section of the Secondary Storage (HDD/SSD) to act as an "overflow" area for the RAM.

Pages

Memory is divided into fixed-size units called Pages. Programs are broken into these pages so they can be moved between RAM and storage easily.

Swapping

The process of moving a "page" of data from RAM to the Hard Disk (and vice versa) to make room for the data currently needed by the CPU.

Disk Thrashing: This occurs when the computer spends more time "swapping" pages between the RAM and Disk than actually executing instructions. This causes the system to become extremely slow or unresponsive.

The Desk Analogy

Imagine your Physical RAM is your Desk and your Secondary Storage is a Filing Cabinet.

  • You can only work on papers that are currently on your desk (RAM).
  • If your desk gets full but you need to open a new folder, you take a folder you aren't using right now and put it in the filing cabinet (Virtual Memory).
  • When you need that folder again, you swap it with something currently on your desk.
  • Thrashing is like spending your entire workday running back and forth between the desk and the cabinet without actually reading any papers!

Advantages of Virtual Memory

  • Multitasking: Allows you to run more applications than the physical RAM capacity would normally permit.
  • No "Out of Memory" Errors: Prevents programs from crashing when RAM is full.
  • Cost-Effective: Using a portion of a hard drive as "extra memory" is much cheaper than buying and installing more physical RAM sticks.
  • Efficient Resource Use: Only the parts of a program currently being used need to be in the expensive, fast RAM.

Cloud Storage

Cloud Storage refers to saving data on remote servers accessed via the Internet, rather than on local storage devices like HDDs or SSDs. These servers are managed by third-party providers.

Types of Cloud Deployment

Public Cloud

Services are provided over the open internet and shared across multiple organizations (e.g., Google Drive, Dropbox). It is cost-effective but offers less control over security.

Private Cloud

A dedicated infrastructure used solely by one organization. It can be hosted internally or by a third party. It offers the highest security and control.

Hybrid Cloud

A mix of both. Sensitive data is kept on a private cloud, while less critical tasks (like email) use the public cloud to save costs.

Benefits and Drawbacks

Benefits Drawbacks
  • Accessibility: Access files from any device with an internet connection.
  • Scalability: Easily increase storage space without buying new hardware.
  • Disaster Recovery: Data is backed up in multiple geographic locations.
  • Collaboration: Multiple users can edit the same document in real-time.
  • Internet Reliance: No internet means no access to your files.
  • Security Risks: Data stored remotely is vulnerable to hacking or data breaches.
  • Ongoing Costs: Monthly subscription fees can become more expensive than a one-time HDD purchase over time.
  • Upload Speeds: Transferring large files can be slow depending on bandwidth.

Summary Note

For IGCSE, remember that Cloud Storage is essentially Magnetic or Solid State storage located in a Data Center. The primary difference is the method of access (Physical connection vs. Internet Protocol).