Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

1.1.3 Input, output and storage

GitHub last commit

Input and output devices are how we interact with a computer. Without them, a computer is just a box that creates heat.

Different devices can be used for different purposes

Input devices

Input devices are devices that provide data or information to a computer. This could be in the form of signals, data, or any other arbitary message.
Common devices include:

  • Keyboards
  • Microphones
  • Cameras

Output devices

Output devices are devices that respond to data provided by the computer to create a perceptible response.
Common devices include:

  • Headphones
  • Speakers
  • Displays
  • Printers

Storage devices

Throughout the years, we have developed different ways of storing data on physical mediums. Each of these different storage devices have different advantages and disadvantages.

CDs and Optical media

CDs are able to store data by burning small indents (pits) into a polycarbonate (plastic) disc using a laser.

When reading from a CD, the laser shines light at the spinning disc. As it rotates, the light will encounter either a pit or a land. Each pit represents a 0, since light is scattered instead of being reflected. Where there is no pit, a land is present, which represents a 1 due to the light being able to reflect back.

CDs are also separated into many sub-categories.
Format-wise, the 3 types are CDs, DVDs, and BluRays.

DVDs were invented as a higher capacity version of CDs, where it allowed data to be stored on two layers of the disc. This increased capacity significantly, where the size of DVDs ranges from a max of 4.7GB on single layer, or 8.5GB on dual layer DVDs.

BluRays currently offer the highest capacity of the optical storage mediums, thanks to their blue laser having a shorter wavelength. There are several formats of BluRay, ranging up to 4 layered discs, with a maximum capacity of 128GB. The standard single layer BluRay has approximately 25GB of storage per layer.

Optical storage is also separated by their readability. CDs and DVDs come in ROM, -R, and -RW variants.
ROM variants can only be written to once, often in factories. This variant is generally used for media distribution, such as music.
-R variants stand for “recordable”, and are distributed without any data, and the user can write data once but never again. This is generally used for archival purposes, such as old photos, videos, etc. -RW variants stand for “Read write”. These discs can be written to multiple times, and are the most versatile of the three.

HDDs and Magnetic storage

Magnetic storage devices are some of the most common storage devices. These store data by manipulating the polarity of a magnetic platter.
Magnetic storage devices include HDDs, floppies, and tapes.

HDDs work by spinning a cobalt alloy disc (the platter) at high speeds, where a read head containing another magnet can read and alter the magnetisation of small parts of the platter. The rotation speed is a primary factor in the read speed of the disc, since the read head can get to specific parts of the platter faster.

The performance of a HDD can vary significantly. Since HDDs rely on physical movement, to access different data locations, data can become fragmented across a drive, where different parts of a file or folder are physically separated on the platter. Fragmentation can hinder read-write speeds, since the drive will need to wait for the rotation to finish to get to those sections.
Fragmentation is caused where there is not enough contiguous space to store the whole file, so the HDD will store the file in the next available location.

HDDs also are quite easy to recover data from, since the first thing to fail in the HDD is the rotational mechanisms or the read head. The platter can often be transplanted to recover the data.
In addition, HDDs are very good in their cost efficiency. High capacity HDDs are often cheaper than high capacity SSDs (especially during the current shortage as of early 2026).

HDDs however are not robust, and vibrations or movement can hinder or even stop a HDD from working correctly during the movement.
Their speeds being limited to physical movements are also a limiting factor. Server grade and enterprise HDDs only go up to a maximum rotation of 15,000 RPM, which is significantly slower than the read speeds of SSDs.

SSDs

SSDs are the current modern storage technology, making use of flash memory to store data.
SSDs contain no moving parts, making them less prone to failure and damage, and also significantly faster than HDDs since they don’t rely on needing to spin to the data physically.
SSDs are also more robust for the same reason, meaning that they are are more suitable for devices that constantly move, such as laptops.

SSDs however have shorter lifespans. This is mainly due to write limits and bit-rot. Each memory cell has a limited number of write limits, as writing data physically degrades the flash memory cells. Bit rot is the slow loss of charge of the stored data where bits can flip if left unpowered for long periods.

SSDs are currently the fastest developing technology as well. The current maximum SSD capacity is ~245TB, held by Kioxia for data centre usage. SSDs are also faster than HDDs in almost all cases. The extent of this depends on the type of SSD, either SATA (the most common connector, shared by HDDs and SSDs), or NVMEs which is a protocol that uses PCIe to increase transfer speeds.
NVMEs have a max read speed of ~14,000MB/s (PCIe 5.0) and SATA has a max read speed of 600 MB/s.

SSDs unfortunately are much more expensive in general (especially now during the current shortage from companies moving to High Bandwidth Memory production for AI) than other storage technologies.

Note

Please check out Isaac Computer Science for more information about how exactly data is stored in these storage mediums. It doesn’t appear to be in the spec, so I have omitted a lot of that information here.

Virtual Storage

Virtual storage is the pooling of physically separate storage devices into what appears to the user to be a single network storage device, through a combination of hardware and software. Virtual storage is generally used for NASes, cloud storage, or any other remote storage that is not physically on your device.

Virtual storage is generally useful for the convenience of not managing many drives at once, however it does also provide extra benefits.
Utilising virtual storage allows you to separate data across drives, and also provide redundancy. For example, if you have 4 drives, you can use 3 of them to store data, and the 4th drive to store a small amount of duplicated data from the other 3 drives. This way, if one of the drives fails, you can still recover some of your data from the backup drive.

NAS and SAN

A NAS (Network Attached Storage) is a virtual storage drive connected to a network, via a service running on a server. It allows multiple authorised devices and users (or just make it public wcgw) store and access files from a centralised location.

A SAN (Storage Area Network) is a dedicated computer network that lets servers access shared, consolidated block-level storage (like disk arrays and tape libraries) as if it were directly attached storage. A SAN typically uses its own storage network separate from the local area network. SANs are good at clustering and use iSCSI. They are more scalable and reliable. Both NAS and SAN present themselves as a single drive to the user. Advantages include improved accessibility, cost efficiency, centralised management, and scalability. Disadvantages include security, complexity, latency, trust, and reliance on connectivity.

Note

For more information, check out RAID which is a common implementation of virtual storage with parity and distributing data across multiple drives through striping or mirroring.

Suitability of different storage devices.

Each of these storage devices are suitable for different situations. In the exam, you may be asked to provide a storage device and explain why it’s good for that specific scenario.

Generally, it can be shortened to:

Needs fast read/writeSSD
Needs high capacityHDD/SSD
Needs cost effective storageCD, HDD
Needs to move data safelyCD, SSD, Cloud
Needs portabilitySSD, Cloud
Needs small form factorUSB sticks, NVME SSD

Primary Storage

Primary storage means directly accessible by the CPU and is made up of RAM and ROM.

RAM

RAM, or random access memory, is generally on the order of gigabytes, is located close to the CPU and is used to store instructions and data currently in use. It is Slower than cache, but is faster than secondary storage. It is very fast (solid-state: stored data as small charges of electricity), however it is volatile (loses data when power is lost), and the charge needs to be refreshed, which happens in sync with the system clock.

RAM is split up into storage blocks, each of which has an address. Each block in memory is a fixed size (1B). For 64-bit CPUs (for example), the CPU reads from 8 blocks at once.

There are two types of RAM:

  • Static RAM (holds data as long as there is a power supply)
  • Dynamic RAM (requires the data to be refreshed by reading and rewriting data due to leakage from capacitors)

SRAM takes up more space and is more expensive, but is faster so is used for cache. DRAM is normal system RAM.

RAM can be extended with virtual memory, where secondary storage acts as RAM. It can be used to temporarily store data to free up space. This is typically data not being used by the user e.g. minimised background apps or tabs. If data is constantly swapped in and out it can result in thrashing on HDDs, and slows down the computer. Data has to be copied back to RAM to be used.

Note

In SSDs, virtual memory can use up the limited program/erase cycles an SSD has. This is particularly an issue with some modern “RAMpocalypse” era laptops with small amounts of RAM, such as the MacBook Neo, but in laptops with sufficient RAM (or for light users), this is not a major issue.

ROM

ROM is read only memory. Data on here is ‘firmware’ and contains the boot sequence instructions needed to turn on a computer, as well as the UEFI/BIOS. It is usually on the order of megabytes, and usually can only be written with a firmware update. ROM is usually built into the motherboard and is a non-volatile storage medium. Despite it being used for BIOS/UEFI, it cannot store UEFI settings, and therefore this is stored on a small volatile piece of memory powered with the CMOS battery. ROM has relatively fast data access rates, but is slower than RAM.

In embedded systems, ROM can also store the OS. It is cheaper (as only a tiny amount of RAM is needed as instructions don’t need to be copied into RAM), it is faster (as the OS is instantly available - there is no startup sequence as no copy to RAM is required), and there is power loss protection (system files cannot be corrupted by power loss). However, it is of course read only and the OS cannot be updated.