Data Storage and Compression
Edexcel's binary storage units, the three types of secondary storage and how to choose between them, and lossy against lossless compression with the reasoning that earns the marks.
Units of storage
A bit is one binary digit. A nibble is 4 bits. A byte is 8 bits.
Edexcel uses binary prefixes, in which each unit is 1024 of the one below:
| Unit | Size |
|---|---|
| kibibyte (KiB) | 1024 bytes |
| mebibyte (MiB) | 1024 KiB |
| gibibyte (GiB) | 1024 MiB |
| tebibyte (TiB) | 1024 GiB |
This is a genuine board difference and it changes every answer. Divide by 1024 at every step and label the unit with the correct name.
Why 1024 and not 1000
Memory is addressed in binary, so its natural sizes are powers of two. 1024 is 2 to the power 10, which is the nearest power of two to a thousand, and that is why it became the unit.
Number base converter
Convert between denary, binary and hexadecimal, with every step of the working written out. This tool needs JavaScript, so turn it on to use it. Everything you need to answer the exam question is explained in the text above.
- A bit is one binary digit: a single 0 or a single 1.
- Eight bits make a byte, which is enough for one character.
- A thousand bytes make a kilobyte. A page of plain text.
- A thousand kilobytes make a megabyte. A photograph, or a minute of music.
- A thousand megabytes make a gigabyte, and a thousand of those a terabyte.
- Image: width × height × colour depth. Every pixel costs the colour depth in bits.
- Sound: sample rate × bit depth × seconds, and × 2 for stereo.
- Text: number of characters × bits per character. ASCII uses 8.
- Divide by 8 to turn bits into bytes, then by 1,000 for each step up.
Secondary storage
Primary storage is memory the processor can address directly, chiefly RAM, and it is volatile: its contents are lost when power is removed. Secondary storage is non volatile and holds programs and data permanently.
Magnetic
A hard disk drive stores data as magnetised regions on spinning platters, read by a moving head.
- Very large capacities at a low cost per gigabyte.
- Slower than solid state, because the head must physically move to the data.
- Fragile when moved, since it contains moving parts.
- Suits desktop machines, servers and backups where capacity matters more than speed.
Solid state
A solid state drive stores data in flash memory cells with no moving parts.
- Much faster access, and the same speed wherever the data is stored.
- Silent, durable and low power, which matters in a laptop.
- More expensive per gigabyte.
- A finite number of write cycles per cell, though modern drives outlast most machines.
Optical
CDs, DVDs and Blu-ray discs store data as pits and lands read by a laser.
- Very cheap per disc and easy to distribute or post.
- Low capacity and slow.
- Read only formats cannot be altered, which suits distributing software or films.
Choosing between them
The right answer to a "which should they use" question always comes from the situation given. Ask four questions: how much capacity is needed, how fast must access be, will the device be carried around, and what is the budget. A laptop for a travelling salesperson wants solid state for durability and speed. An archive of ten years of CCTV wants magnetic for cost per terabyte.
- Magnetic: spinning platters with a head floating over the surface.
- Solid state: a grid of cells holding charge, with no moving parts.
- Optical: one spiral track of pits and lands, read by a laser.
- Which one depends on capacity, speed, durability and cost per gigabyte.
Compression
Compression reduces the number of bits needed to store a file, which saves storage, reduces transmission time and uses less bandwidth.
Lossy
Lossy compression permanently removes data judged to be less important. The reduction is large and the original cannot be recovered exactly.
JPEG discards fine colour detail the eye barely registers. MP3 removes frequencies most people cannot hear and sounds masked by louder ones.
Appropriate for photographs, music and video, where human perception does not notice what has gone.
Lossless
Lossless compression stores exactly the same information more efficiently, so the original file is reconstructed perfectly. The reduction is more modest.
Used by PNG, ZIP and FLAC, and essential for text, program code, spreadsheets and databases, where every character matters and removing any of it would corrupt the file.
Run length encoding
A simple lossless method that replaces a run of repeated values with the value and a count.
W W W W B B W W W W W W becomes 4W 2B 6W.
Twelve values become six, and nothing is lost. It works well on simple graphics with blocks of flat colour, and badly on photographs, where almost every run has length one and the result is larger than the original.
"Lossless, because it is a spreadsheet and losing any value would make the figures wrong" is the full answer. Simply naming a method is half of it.
- The original file: every byte of the data, nothing thrown away.
- Lossless finds repetition and records it more briefly.
- Unpack it and you get back exactly what you started with.
- Lossy throws data away permanently, and gets much smaller.
- Lossless: the file gets smaller, and decompressing gives back exactly the original.
- Lossy: the file gets much smaller, but detail is thrown away for good, so it cannot be restored exactly.
- Choose lossless when the data must be exact, and lossy when small losses do not matter.
Key terms you must be able to define
- Bit
- A single binary digit, either 0 or 1.
- Byte
- Eight bits.
- Kibibyte
- 1024 bytes.
- Mebibyte
- 1024 kibibytes.
- Volatile
- Losing its contents when power is removed, as RAM does.
- Secondary storage
- Non volatile storage holding programs and data permanently.
- Magnetic storage
- Storage using magnetised regions on spinning platters, read by a moving head.
- Solid state storage
- Storage using flash memory cells with no moving parts.
- Optical storage
- Storage using pits and lands on a disc, read by a laser.
- Lossy compression
- Compression that permanently removes data, so the original cannot be recovered exactly.
- Lossless compression
- Compression that stores the same information more efficiently, so the original is recovered exactly.
- Run length encoding
- A lossless method replacing a run of repeated values with the value and a count.
Flashcards
Say the definition out loud before you flip the card. Retrieving it from memory is what builds recall, reading it again is not.
Reach the top grade on this topic
Storage questions are almost always scenario questions, and the marks are for matching the choice to the situation.
Quote the situation back. "The drive will be carried between sites, so solid state is the better choice because it has no moving parts to be damaged by being knocked" uses the question rather than reciting a table.
Give capacity and cost together. Magnetic wins on cost per terabyte, which only matters when the capacity required is large. Saying both makes the argument complete.
Justify compression from what the file is. Photographs and music tolerate loss because perception does not register it. Text and code cannot, because every character carries meaning.
Use the right units. Kibibyte, mebibyte, gibibyte, and divide by 1024.
Mistakes that cost marks here
- Dividing by 1000 rather than 1024.
- Saying lossless compression removes data. It removes redundancy in how data is stored.
- Recommending optical storage for anything needing speed or large capacity.
- Claiming solid state is always the right choice. Cost per gigabyte still favours magnetic for large archives.
- Assuming run length encoding always reduces size. On data without runs it makes the file larger.
A solid state drive has no moving parts at all, but each memory cell can only be rewritten a finite number of times. Drives spread writes evenly across every cell precisely so that no single one wears out first.
Knowledge check
Exam-style questions
Five written questions in the style of the real paper. Write a full answer, then let the marker check it against the mark scheme.
- LFaster access, or no moving parts so more durable, or lower power use
Solid state storage has no moving parts, so it is far more durable when the device is carried around, and data is accessed considerably faster because there is no read head that must physically move to the right place.
- LRecommends magnetic storage
- LJustifies it on the very large capacity required
- LJustifies it on cost per gigabyte or terabyte
- LNotes that the slower access speed does not matter for an archive
The company should use magnetic hard disk storage. The volume involved is very large, and magnetic drives offer by far the lowest cost per terabyte at that scale, so the whole archive can be held for a fraction of what solid state would cost. The main drawback of magnetic storage is that access is slower, because the read head has to move physically to the data, but that is close to irrelevant here since the footage is being archived and will rarely be read. Optical storage is unsuitable because a single disc holds only a few gigabytes, so 40 tebibytes would need thousands of them.
- LLossy compression permanently removes data
- LSo the original file cannot be recovered exactly
- LLossless compression stores the same data more efficiently
- LSo the original file can be reconstructed exactly
Lossy compression achieves a large reduction in size by permanently discarding data that is judged to be less important, such as colour detail in an image that the eye barely registers or frequencies in audio that most people cannot hear. Because that data is gone, the original file can never be reconstructed exactly. Lossless compression instead finds a more efficient way of storing exactly the same information, for example by replacing runs of repeated values with a value and a count. Nothing is discarded, so decompressing gives back a file identical to the original, but the reduction achieved is more modest than lossy compression can manage.
- LIdentifies the runs as five B, two W, three B
- LWrites them as value and count pairs
- LStates that six values replace ten, saving four
The row contains five B, then two W, then three B, so under run length encoding it is stored as the pairs 5B, 2W, 3B. That is three pairs, which is six values in total, in place of the ten values in the original row, so four values are saved. Nothing has been lost, since the original row can be written out again exactly from the pairs.