Understand how data storage is measured
📦 Data Storage & Compression
In IGCSE Computer Science, you’ll need to know how to measure how much data a file or a set of files takes up, and how to make that data smaller with compression. Think of data as a library: the more books you have, the more shelves you need. Storage units are the shelves, and compression is like putting books into a tighter stack.
🔢 Bits and Bytes
Everything in a computer is stored as bits (0 or 1). A byte is 8 bits.
$$1 \text{ byte} = 8 \text{ bits}$$
When you see a file size like 5 MB, it means 5 megabytes of data.
📊 Units of Storage
| Unit | Abbreviation | How many of the previous unit? |
|---|---|---|
| Byte | B | 1 |
| Kilobyte | KB | $2^{10}=1024$ |
| Megabyte | MB | $2^{10}$ KB |
| Gigabyte | GB | $2^{10}$ MB |
| Terabyte | TB | $2^{10}$ GB |
| Petabyte | PB | $2^{10}$ TB |
Remember: 1 KB = 1024 B, 1 MB = 1024 KB, and so on.
🔄 Converting Units
- To increase a unit (e.g., KB to MB), multiply by
1024. - To decrease a unit (e.g., GB to MB), divide by
1024.
Example: 5 GB to bytes:
$$5 \times 1024^3 = 5 \times 1\,073\,741\,824 = 5\,368\,709\,120 \text{ bytes}$$
🧩 Compression Basics
Compression reduces the size of data so it takes up less storage or bandwidth.
- Lossless compression keeps every bit of data. Example:
ZIP,PNG. - Lossy compression removes some data to achieve higher compression. Example:
JPEG,MP3.
Analogy: Lossless is like folding a letter neatly – you can unfold it exactly as it was. Lossy is like compressing a photo with a filter – some details are lost but the image still looks good.
📐 Compression Ratio
The compression ratio tells you how much smaller the compressed file is compared to the original.
Formula: Compression ratio = $\frac{\text{original size}}{\text{compressed size}}$
Example: A 10 MB file compressed to 2 MB:
$$\frac{10}{2} = 5$$
So the ratio is 5:1 – the compressed file is 5 times smaller.
📚 Exam Tips
- Always use
1024when converting between binary units (KB, MB, GB, etc.). - Show your work when converting units or calculating compression ratios.
- Remember: 1 KB = 1024 B, 1 MB = 1024 KB, 1 GB = 1024 MB.
- When asked to calculate storage for a set of files, sum the sizes first before converting.
- For compression questions, identify whether the method is lossless or lossy and give an example.
- Use the formula for compression ratio:
original / compressedand express the answer as a ratio (e.g., 4:1). - When converting to bytes, use
bytes = kilobytes × 1024, then repeat for higher units. - Use a calculator for large numbers, but show the multiplication steps.
- Check that your final answer is in the correct unit requested by the question.
- Remember that exam questions may ask you to convert petabytes to gigabytes or vice versa – use the table for quick reference.
Revision
Log in to practice.