Inside a computer all information is stored as binary numbers – either a 1 or a 0. In a computer this will mean either a switch being open or closed, or the presence or absence of a voltage signal travelling down a wire.
Every single type of data – sound, graphics, text, animations, etc. will always be stored as a series of binary numbers. Each of these numbers has a size, the bigger the size, the bigger the data.
In this lesson, we’ll learn about:
- The different units of data storage.
- How to convert between the different units of data storage.
- Why data needs to be converted to binary in order to be processed.
1. The Units of Data Storage
The smallest unit of data inside a computer is called a bit. This represents either a 1 or a 0. It corresponds to a micro switch inside the CPU or RAM or an SSD drive.
This is shown in figure 1 – here if the switch is OPEN, it means a 0, if it is CLOSED, it means a 1. All this means is that if it is closed, electricity can flow through the switch.
Inside the computer there are millions of switches that are constantly opening and closing, as they store different numbers, or do different calculations.
The wires on the motherboard that move data around will either have a voltage (1) or will not (0) and this is how data is moved from the hard drive to RAM and to the CPU.
If a piece of data can only be a 1 or a 0, then it is called BINARY data.
Computers usually store data using much larger values than individual bits though, so there are other units of measurement we can use when referring to these larger values.
A group of 8 bits is called a byte.
A group of 4 bits is called a nibble (because a nibble is a small byte – say it out loud to yourself!).
We usually deal with groups of bytes, rather than individual bits.
The table below shows the different unit names that you need to be familiar with.
You will have seen these numbers relating to processor speed – a 2.3 Gigahertz processor will carry out 2.3 billion operations per second.
The table below shows us the units being applied to memory capacity.
|Unit Name||No. of Bytes||Meaning|
|Kilobyte||103||1 Thousand Bytes|
|Megabyte||106||1 Million Bytes|
|Gigabyte||109||1 Billion Bytes|
|Terabyte||1012||1 Thousand Billion Bytes|
|Petabyte||1015||1 Million Billion Bytes|
You will have seen these numbers when buying your phone, which might have a 128 Gigabyte flash drive, or a new computer might have a 1 Terabyte hard disk drive.
Research the typical storage capacity for a computer built in 2010. Look at how much storage capacity has increased since then.
2. Converting Between Units
The way to convert numbers is shown in figure 2.
Basically, if you are going from big numbers to small numbers, you need to multiply.
If you are going from small numbers to big numbers, you need to divide.
Let’s look at some worked examples:
Worked Example 1
How many bytes are in 3 Kilobytes?
So looking at the table below, we have to do 1 multiplication jump:
So 3 Kilobytes = 3000 bytes.
Worked Example 2
How many bytes are in 5 Megabytes?
Again, looking at the table below, we have to do 2 multiplication jumps:
So 5 Megabytes = 5,000,000 bytes (5 million bytes).
Worked Example 3
How many Kilobytes in 6500 bytes?
This time we need to divide, so looking at the table below, have to do 1 division jump:
So 6500 bytes = 6.5 Kilobytes.
Buying computers now with Terabyte hard drives is common. Research what is the largest available hard drive, and what is the largest hard drive currently in use in the world.
3. Why Data is Converted to Binary
When you type a letter on your keyboard – have you thought about what is going on?
An electrical signal goes from your keyboard to your CPU. That signal will turn some switches on and off, and the operating system and CPU recognise these instructions and use this to print out the letter you have typed on the screen.
All of the registers inside the CPU basically consist of millions of tiny switches. There is also a part of the CPU called the ALU – the Arithmetic Logic Unit, whose job it is to perform any calculation that has to be carried out – any addition or subtraction. However, all of these numbers can only be stored and processed as switches that are either open or closed, and so are a 1 or a 0.
The CPU has no idea what a decimal number is, or a photo, or an MP3, or a game. All it knows about is that some switches have to be open, and some need to be closed. In this way, all data in your computer needs to be converted into binary in order for it to be processed.
Can you think of any data that might not be stored as binary data inside a computer?
ADVANCED THOUGHT: Binary data is thought of as existing as a binary state 1 or 0, but quantum computing can exist in multiple states at once. How?
So to summarise what we’ve learnt in this lesson:
- All data exists in a computer as binary data – a 1 or a 0.
- This corresponds to a switch being open (0), or closed (1).
- The smallest unit of data is a bit which is either 1 or 0.
- We often group bits together into larger units of data, such as:
- A nibble is 4 bits.
- A byte is 8 bits.
- A Kilobyte is a thousand bytes.
- A Megabyte is a thousand Kilobytes.
- A Gigabyte is a thousand Megabytes.
- A Terabyte is a thousand Gigabytes.
- A Petabyte is a thousand Terabytes.
- To convert between units, you need to multiply when going from large to small, and divide when going from small to large.