Cambridge IGCSE Computer Science Notes

Chapter 3 · Hardware

3.3 Data storage

This topic explains the different kinds of computer memory and storage, how RAM and ROM differ, how magnetic, solid-state and optical storage work, and how virtual memory and cloud storage extend the ways data can be kept and accessed.

Primary memorySecondary storageHDD & SSDOptical mediaVirtual memoryCloud storage

What you need to understand

You should be able to distinguish primary memory from secondary/off-line storage, compare RAM and ROM and DRAM and SRAM, explain HDD/SSD/optical technologies, describe virtual memory and disk thrashing, and evaluate cloud storage including public, private and hybrid clouds.

3.3.1

Primary memory

Primary memory is memory the CPU can access directly. In this topic it includes RAM and ROM; cache memory is also directly accessible and is discussed with CPU architecture. Primary memory is used for the data, instructions and services the processor needs while the computer is working.

Course-book Figure 3.58 comparing primary memory with secondary storage
Course-book Figure 3.58: primary memory compared with secondary storage.
Course-book Figure 3.59 showing RAM and ROM, with SRAM and DRAM as RAM types
Course-book Figure 3.59: the structure of primary memory.

Random access memory (RAM)

RAM is the computer's temporary working memory. When an application is run, the required program instructions and data are copied from secondary storage into RAM because access is much faster there. Any RAM location can be accessed independently of the location used previously.

DRAM and SRAM

DRAMSRAM
Uses transistors and capacitors.Uses flip-flop circuits to hold bits.
Capacitor charge must be refreshed repeatedly.Does not require constant refreshing.
Cheaper to manufacture and generally offers greater capacity.Faster data access but more expensive.
Uses less power than SRAM according to the source comparison.Used where speed is especially important.
Commonly used for main memory.Commonly used for CPU cache.

In DRAM, a capacitor stores the bit and a transistor acts as a switch that allows circuitry to read or alter it. The capacitor gradually loses charge, so it must be refreshed. SRAM keeps its bit using a flip-flop and therefore does not require that continual refresh cycle.

Read-only memory (ROM)

ROM is permanent, non-volatile primary memory. Its stored contents are intended to be read rather than altered by the user or ordinary programs. It is used for instructions and data that must still exist when the machine has been powered off, including start-up instructions such as the BIOS/bootstrap routines described in the textbook.

RAMROM
TemporaryPermanent
VolatileNon-volatile
Read/writeNormally read-only for the user/system
Stores current programs, data and parts of the OSStores start-up instructions and fixed data
Increasing capacity can improve working performanceRetains required instructions when power is removed

RAM and ROM in an embedded device

The textbook's remote-controlled toy-car example shows the distinction clearly. ROM can hold factory settings, start-up routines and fixed rules such as how remote-control buttons map to movement. RAM can hold temporary instructions or routines entered by the user and data received from the remote control while the toy is operating.

Check primary memory.
3.3.2

Secondary and off-line storage

Secondary storage is not directly addressable by the CPU. It provides non-volatile, long-term storage for the operating system, applications, device drivers and user files such as documents, photographs and music.

Compared with primary memory

Secondary storage usually provides much greater capacity, but its access time is slower than RAM or ROM.

Internal or external

Storage can be fitted inside the computer, such as an internal HDD or SSD, or connected externally/removably for backup and file transfer.

The source groups the technologies used for secondary/off-line storage into magnetic, solid-state and optical storage. The next subtopic explains how each works.

Check secondary storage.
3.3.3

Magnetic, optical and solid-state storage

Magnetic storage — hard disk drives (HDDs)

An HDD stores binary data magnetically on spinning disks called platters. Read/write heads containing electromagnets move across the surfaces to read or change the stored data. A drive can contain several platters, and both sides of a platter can be used.

Course-book Figure 3.63 showing tracks and sectors on a magnetic disk
Course-book Figure 3.63: tracks and sectors.

The disk surface is divided into tracks and sectors. A sector stores a fixed amount of data. The head moves directly to the required track/sector, but once there the required part of the rotating disk must pass underneath the head. The delay involved is latency.

Fragmentation

After many files are created, edited and deleted, a file's sectors may become scattered around the disk rather than sitting together. This fragmentation increases head movement and can reduce performance. Defragmentation software reorganises the sectors to reduce the problem.

External/removable HDDs use the same basic magnetic technology and can be connected through USB for backup or file transfer.

Solid-state drives (SSDs)

SSDs have no moving parts. The source describes flash storage as controlling electrons in NAND or NOR semiconductor chips. Cells contain a floating gate and a control gate. Trapped charge in the floating gate represents a stored bit, making the device non-volatile.

Course-book Figure 3.64 showing floating gate and control gate structure in flash memory
Course-book Figure 3.64: simplified flash-memory cell.
Benefits of SSD over HDDLimitation described in the source
No moving parts, so greater mechanical reliability.Flash cells have a limited number of write/erase cycles — SSD endurance.
Lighter and thinner.Existing flash data is erased before new data is written to the same location.
Lower power use and less heat.High-write applications can place greater demands on endurance.
No spin-up delay and much faster data access.Long-term durability is a factor to consider.

Memory sticks / flash memory

USB memory sticks use solid-state technology. Their small size and low weight make them convenient for transferring files and keeping small backups. The source also describes a dongle use: software may require files stored on the device before it will run, helping prevent unauthorised use or copying.

Optical storage — CD and DVD

CDs and DVDs store data on a single spiral track using pits and lands. A red laser reads or writes the surface. The disk is also divided into sectors for direct access. Discs marked R are write-once; RW discs can be rewritten.

Course-book Figure 3.65 showing the spiral track, pits and lands of optical media
Course-book Figure 3.65: optical media.

DVDs can use dual-layering. Two recording layers are separated inside the disc and the laser focuses at slightly different depths to read the required layer.

Course-book Figure 3.66 showing two recording layers in a DVD
Course-book Figure 3.66: dual-layer DVD structure.

DVDs use a shorter-wavelength laser than CDs, allowing smaller pits and track spacing and therefore more data to be stored on the surface.

Blu-ray

Blu-ray uses a blue laser with a shorter wavelength than the red laser used by DVD. The source explains that smaller pits and lands can therefore be used, increasing capacity. It also notes higher transfer rates, built-in secure encryption, single- and dual-layer forms, and greater interactivity for recorded media.

Course-book Table 3.11 comparing CD DVD and Blu-ray laser colour wavelength disk construction and track pitch
Course-book Table 3.11: CD, DVD and Blu-ray comparison.
Choosing a storage technology: think about capacity, access speed, portability, durability, power use, physical size, cost and whether the medium needs to be rewritable.
Check storage technologies.
3.3.4

Virtual memory

When running programs need more RAM than is available, part of an HDD or SSD can be used as extra working space. The textbook describes physical RAM together with this reserved swap space as the basis of virtual memory.

Without virtual memory

If RAM is full and another program needs memory, there is no free RAM address space for the new data. Without another memory-management mechanism, the program cannot be given the space it requires.

Course-book Figure 3.68 showing RAM full without virtual memory
Course-book Figure 3.68: normal memory management without virtual memory.

With virtual memory

The operating system can move a block of data that is not immediately required from RAM to the HDD/SSD. The newly freed RAM space can then be allocated to another program. A mapping structure keeps track of where each program's data currently resides.

Course-book Figure 3.69 showing program address spaces mapped to RAM and HDD SSD
Course-book Figure 3.69: a program temporarily mapped to HDD/SSD while RAM is full.

When the waiting program is brought into RAM, older or less immediately required data can be moved out to swap space and the map is updated.

Course-book Figure 3.70 showing an updated mapping after RAM space is reassigned
Course-book Figure 3.70: RAM space reassigned using virtual memory.

Paging moves fixed-length blocks called pages between RAM and the HDD/SSD. Virtual memory gives the impression that more memory is available than the installed physical RAM alone.

BenefitsCosts / risks
Programs larger than physical RAM can still run.Secondary storage is much slower than RAM.
RAM does not have to hold every part of every program all the time.Frequent swapping can seriously reduce performance.
Can reduce the immediate need to install additional RAM.Heavy HDD swapping causes disk thrashing.

Disk thrashing and the thrash point

When the system spends more and more time moving pages between RAM and an HDD than executing instructions, disk activity becomes extremely high. This is thrashing. If it becomes so severe that useful processing effectively stops, the system has reached the thrash point.

The source suggests reducing the problem by installing more RAM, running fewer programs at the same time, reducing swap-file size, or using an SSD rather than an HDD so page transfers do not require mechanical head movement.

Check virtual memory.
3.3.5

Cloud storage

Cloud storage keeps data on remote servers managed in a hosting environment rather than only on the user's local device. Copies can be stored on more than one server so data remains available if a server needs maintenance or fails; this duplication is called data redundancy.

Public, private and hybrid cloud

Public cloud

The client and the cloud-storage provider are separate organisations.

Private cloud

Storage is provided in a dedicated environment behind the organisation's firewall; the storage system and organisation operate as one entity.

Hybrid cloud

A combination: more sensitive information can stay in the private environment while less sensitive data uses public cloud services.

Course-book Table 3.12 listing benefits and drawbacks of cloud storage
Course-book Table 3.12: benefits and drawbacks of cloud storage.

Benefits

Drawbacks and security questions

The textbook gives historical examples to show why organisations assess these risks carefully, including a hypervisor security issue that forced cloud reboots, a provider losing data during a backup operation, compromised private photo accounts, and a 2016 breach involving Mexican voter-registration data. The purpose of these examples is to show that off-site storage still requires strong security and reliable backup procedures.

Remember: cloud storage is not the same as having no physical storage. The data still exists on physical servers — it is simply stored remotely and accessed through a network.
Check cloud storage.

Topic 3.3 revision checklist

Distinguish primary memory from secondary/off-line storage.
Explain RAM, ROM, volatility and start-up instructions.
Compare DRAM and SRAM and state typical uses.
Describe how HDDs use platters, tracks, sectors and read/write heads.
Explain latency, fragmentation and defragmentation.
Describe how SSD/flash cells store data and compare SSD with HDD.
Explain memory sticks and dongles.
Describe CD/DVD pits, lands, laser reading and dual layering.
Compare CD, DVD and Blu-ray.
Explain virtual memory, swap space, paging, thrashing and thrash point.
Distinguish public, private and hybrid cloud storage.
Evaluate cloud-storage benefits, drawbacks, redundancy and security.
Ready for a mixed Topic 3.3 check?
← Topic 3.2 Input and output devicesComputer Science contentsTopic 3.4 Network hardware →