[3.3.1–2] Primary vs secondary; RAM vs ROM

Primary and secondary storage: what they are and why they matter

Primary storage holds data and instructions that the processor needs right now. It is directly accessible by the CPU and designed for speed. The two main forms are RAM (Random Access Memory) and ROM (Read Only Memory). In contrast, secondary storage keeps data and software long term even when power is off. Typical examples are hard disk drives, solid-state drives, memory cards, and optical discs.

Thinking about storage helps you predict how fast a system will feel, how much it can remember, and what happens when power is lost. A sensible mental model is: CPU fetches from primary storage during processing; files and applications are saved to secondary storage so they persist. When an app starts, its code and required data are copied from secondary storage into primary storage so the CPU can work with them quickly.

At a glance: roles and properties

Aspect Primary storage (RAM, ROM) Secondary storage (HDD, SSD, etc.)
Main purpose Hold current instructions and data for fast access; store start-up firmware Store files, applications, and user data long term
Volatility RAM is volatile (loses contents when power is removed); ROM is non-volatile Non-volatile (keeps data without power)
Speed Very fast access times measured in nanoseconds Slower than RAM; SSDs are faster than HDDs; optical is slowest
Capacity Smaller (e.g. a few GB to tens of GB in typical PCs/phones) Larger (e.g. hundreds of GB to multiple TB)
CPU access Directly addressable by the processor Accessed via I/O controllers and the file system

RAM and ROM in more detail

Although both RAM and ROM are part of primary storage, they serve different roles. RAM acts as the system's short-term workspace, while ROM provides reliable instructions for bootstrapping and essential control code. The tabs below walk through how each behaves in common situations.

RAM: when you launch a programme, the operating system loads parts of its code and data from secondary storage into RAM. The CPU fetches instructions and reads or writes variables in RAM billions of times per second. Because RAM is volatile, anything not saved will be lost if power fails.

ROM: usually not involved directly in app execution during normal use. It holds fixed code such as firmware settings or bootstrap routines and is read when needed by the system, but is not the main workspace.

ROM provides trustworthy instructions to start the system. On power-up, the CPU executes code from ROM (or flash memory behaving like ROM) to perform checks, initialise hardware, and locate the operating system on secondary storage.

RAM is cleared and initialised so the OS can create a clean environment for processes. After this, RAM becomes the active workspace again.

Many devices use flash memory that can be rewritten, even though it acts like ROM at run time. Firmware updates replace stored code to fix bugs or add features. The process must be protected (e.g. only signed updates) and power-safe (e.g. a fallback image) so the device is not left unusable if the update is interrupted.

Types of RAM you may encounter

  • DRAM (Dynamic RAM): stores each bit using a tiny capacitor that must be refreshed regularly. Provides large capacity at low cost and is used as main memory.
  • SRAM (Static RAM): uses flip-flops that do not need refresh. Much faster and used for cache, but more expensive and lower capacity.
  • Virtual memory (operating system feature): extends apparent RAM size by temporarily moving less-used data to secondary storage. It allows more programmes to run but is slower than real RAM.

Types of ROM and ROM-like storage

  • MROM/Mask ROM: programmed at manufacture; cannot be changed later.
  • PROM/EPROM/EEPROM: technologies that can be programmed once (PROM) or erased and reprogrammed (EPROM with UV light; EEPROM electrically). Modern devices commonly use flash memory, a type of EEPROM.
  • Flash memory: widely used for firmware storage and for secondary storage (USB sticks, SSDs). As firmware storage, it behaves like ROM during normal use but can be updated.

Secondary storage: comparing common options

Secondary storage technologies make different trade-offs between speed, capacity, durability, cost, and portability. The right choice depends on the task: fast system drive, large archive, rugged handheld, or cheap distribution medium.

SSD (Solid-State Drive): uses flash memory and a controller. Very fast access times and high transfer rates, silent, shock resistant, lower power. Ideal for operating systems and frequently used applications.

HDD (Hard Disk Drive): stores data magnetically on spinning platters with moving heads. Cheaper per gigabyte and available in very large capacities, but slower and more fragile to shock. Suitable for bulk storage and backups when budget matters.

USB flash drive: robust, plug-and-play, convenient for transferring files between machines. Performance varies by grade and interface.

SD card: tiny removable flash; commonly used in cameras, phones, and embedded devices. Speed classes matter for video recording and rapid burst photography.

Optical discs (CD, DVD, Blu-ray): inexpensive media for distribution or offline archives, but slower and with limited capacity compared to modern drives. Require a compatible drive and careful handling to avoid scratches.

Secondary storage comparison table

Technology Typical capacity Performance Durability/portability Common uses
SSD Hundreds of GB to multiple TB Very fast; low latency Good shock resistance; low power System drive, apps, gaming, creative work
HDD 1 TB to 20+ TB Moderate; mechanical latency Sensitive to shock when spinning Bulk storage, media libraries, backups
USB flash / SD 32 GB to 1 TB (varies) Varies widely by grade Highly portable; small size File transfer, cameras, embedded devices
Optical disc 700 MB (CD), 4.7–8.5 GB (DVD), 25–100+ GB (Blu-ray) Slow access Needs careful handling; long shelf life if stored well Software distribution, archives, media playback

How RAM size, speed, and secondary storage interact

Perceived performance depends on the balance between CPU speed, RAM, and secondary storage. If RAM is too small, the operating system uses virtual memory, moving data to and from secondary storage as you switch tasks. This keeps programmes running but can feel slow because the storage device is much slower than RAM.

Having more RAM allows more applications and data to remain in fast primary storage, reducing waits. Using a faster secondary device (e.g. an SSD) reduces the penalty when loading apps or when virtual memory is used, but it does not replace the need for adequate RAM.

Security, integrity, and persistence

  • Persistence: files are safe on secondary storage even after shutdown; data in RAM is lost unless saved.
  • Integrity: unexpected power loss can corrupt data being written; journalling file systems and caches help reduce risk.
  • Security: encryption can protect secondary storage; RAM contents typically disappear on power-off, but sensitive systems may still clear RAM explicitly on shutdown.

Key terminology

  • Primary storage: memory directly accessible by the CPU (main memory and ROM).
  • Secondary storage: non-volatile storage used to keep data and software long term.
  • RAM: volatile workspace memory for current data and instructions.
  • ROM: non-volatile memory holding fixed startup or control code (often implemented with flash).
  • Cache: very fast SRAM used to reduce average access time to RAM.
  • Virtual memory: OS technique using secondary storage to extend available memory.
  • Non-volatile: retains data without power; volatile loses data when power is removed.

 Key Takeaways

  • Primary storage (RAM and ROM) serves the CPU directly; it is fast and limited in size.
  • RAM is volatile workspace memory for active programmes and data; ROM provides reliable start-up code.
  • Secondary storage (HDD, SSD, optical, flash) keeps data and applications long term and is slower than RAM.
  • System performance depends on the balance of CPU, RAM capacity/speed, and the speed of secondary storage.
  • Flash memory can behave like ROM for firmware yet still be updated safely under controlled conditions.
  • Persistence and security considerations differ: RAM clears on power-off; secondary storage must be managed for integrity and protection.