2.3 - Units of Data Storage
Bits and binary representation
Computers process information using electrical signals, which are represented in a system called binary. Binary uses only two digits: 1 and 0. A 1 indicates that electricity is flowing through a circuit, while a 0 shows that it is not.
All data handled by computers, such as text, images, or sounds, must first be converted into binary code. This code consists of sequences of 1s and 0s.
The smallest unit of data is a bit (short for binary digit), which is a single 1 or 0. For example, the binary code 1101 consists of 4 bits.
Units of data measurement
Data units build upon bits to measure larger amounts of information. Each unit is a multiple of the previous one, typically using factors of 1000 for simplicity in most contexts.
Common data units
| Name | Size | Description |
|---|---|---|
| Bit (b) | 1 binary digit (1 or 0) | The fundamental unit of digital information |
| Nibble | 4 bits | |
| Byte (B) | 8 bits | Large enough to store one character, such as 'A', '5', or '£' |
| Kilobyte (kB) | 1000 bytes | Used for small files, like simple text documents |
| Megabyte (MB) | 1000 kilobytes | Common for images, songs, and basic documents |
| Gigabyte (GB) | 1000 megabytes | Measures high-definition videos and complex software |
| Terabyte (TB) | 1000 gigabytes | Typical for secondary storage devices, like hard drives |
| Petabyte (PB) | 1000 terabytes |
Sometimes, units are defined using 1024 instead of 1000 (e.g., 1 KB = 1024 bytes). This is because 1024 is a power of 2 (210), which aligns with how binary systems organise data in computers.
Number of possible values in binary units
Each bit can be either 0 or 1, giving it two possible states. When bits are combined, the total number of possible values increases exponentially.
Calculating possible values
The number of different values a group of bits can represent is calculated using powers of 2.
Formula for number of values:
2n
Where n = Number of bits
Examples of possible values
- 1 bit: 21 = 2 values (0 or 1)
- Nibble (4 bits): 24 = 16 values (e.g., from 0000 to 1111)
- Byte (8 bits): 28 = 256 values (e.g., from 0000 0000 to 1111 1111)
This principle explains why a byte can store 256 different characters in systems like ASCII.
Converting between data units
Converting between units involves multiplying or dividing by the appropriate factor, such as 8 (for bits to bytes) or 1000 (for bytes to kilobytes).
Steps for conversion
- Identify the starting unit and the target unit.
- Multiply when converting to a smaller unit (e.g., bytes to bits).
- Divide when converting to a larger unit (e.g., kilobytes to megabytes).
- Use multiple steps if needed (e.g., kilobytes to bits requires converting to bytes first).
Worked example - Converting image sizes
Jamie has downloaded images, each 250 kilobytes in size. How many bits are in each image?
Step 1: Identify the values
- Image size = 250 kB
Step 2: Convert kilobytes to bytes
250 kB × 1000 = 250,000 bytes
Step 3: Convert bytes to bits
250,000 bytes × 8 = 2,000,000 bits
Worked example - Checking storage capacity
Jamie wants to copy 500 images onto a USB flash drive. Each image is 250 kilobytes in size, and the USB flash drive has 0.2 GB of free space. Is there enough space?
Step 1: Identify the values
- Number of images = 500
- Size per image = 250 kB
- Free space = 0.2 GB
Step 2: Calculate total size in kilobytes
500 × 250 = 125,000 kB
Step 3: Convert total size to gigabytes
125,000 kB ÷ 1000 = 125 MB 125 MB ÷ 1000 = 0.125 GB
Step 4: Interpretation
0.125 GB is less than 0.2 GB, so yes, there is enough space.