How Computers Work – Part 6 – Bits, Bytes, and Binary [Mega Series]
While writing the RAM part of the series, I found out that you probably would get lost if I didn’t explain binary data (bits and bytes) to you. If you’re already familiar with this concept, I didn’t mean to insult your knowledge, Mr. Know-It-All! Your computer communicates with binary data, and it’s important for you to know how it works before moving on. Even if you feel comfortable with binary, you might want to read up on this to refresh your memory anyway.
What Binary Is and Why Computers Use It
Binary is based on the base2 numerical system. You already know the base10 numeric system (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9), which you use to… uh… count? Well, let’s say you use a base3 numeric system. That would include only 0, 1, and 2. If you get where I’m going, you can conclude that base2 is only composed of 0 and 1.
The binary numeric system is used in computers especially because they have only two recognizable states: on and off. Every transistor in your computer has these two states, like a light switch, and the computer can only communicate by these means. Your computer turns off a transistor to represent a value of 0. Electricity flows into a transistor to turn it on, representing a value of 1. Here’s where binary gets creepy… You obviously need to do more complex calculations on your computer than “0+1″ or “1+0.” So what is “1+1?” In the computing world, it’s “10.”
Remember, you’re using a base2 numeric system, not base10. With base10, each digit represents a power of 10. Let’s take apart the number 263 in base10. This is what the number looks like totally taken apart:
200 + 60 + 3
If we take it to its most basic level, we end up with: (2 x 10²) + (6 x 10¹) + (3 x 10º).
Taking this into consideration, you can now probably realize why (10) base2 = (2) base10. If you don’t, let me draw it out for you: (1 x 2¹) + (0 x 2º) = (2 x 10º). Remember that anything to the power of zero is equal to one.
Can you guess what the base2 number of 111 is in base10? If you still can’t guess, let me draw it out for you:
(1 x 2²) + (1 x 2¹) + (1 x 2º) = x
If you guessed that x is equal to 7, you’re totally right! If you guessed another number, skim by this section a little longer. Maybe it would help you if you took into account that each subsequent digit in a number is equal to itself times the base number to the power of its position as a digit reading from right to left minus one. The statement might sound more confusing, but analyze it carefully. It’s telling you that the “1” in the base10 number of “155” is equal to “1 x 10 ^ (3 – 1)” or “100.” The small carrot ( ^ ) symbolizes a raise in the value of the number behind it by the exponent in front of it.
Now that we’re through with the funky math, we can get to the more “computery” aspects of binary.
4-bit, 8-bit, 16-bit, You’re It!
Each of the base2 numbers described in the previous “math-ish” section is called a “bit” in the computing universe. Bits often fit into “atoms” or “bytes.” An atom, also known as a nibble, is a segment of data composed of 4 bits, hence the term “4-bit” and isn’t used much today. A long time ago, though, this was the big thing in the Intel 4004 microprocessor. You don’t need to worry about this, as you were probably having your first teeth when the processor was already obsolete.
A byte, however, is a segment of data commonly used in computing, which contains 8 bits. It’s a leftover of the old 8-bit processing model that newer processors have built upon. Every letter you read on this screen is composed of one byte, or eight bits. The uppercase letter “A,” separated into nibbles, is:
Can you guess what numeric value that has? Take a moment to calculate it, just so you get used to base2 mathematics. Some of what we discuss on this site might confuse you if you don’t know how to calculate a base2 number. In case you want to verify your answer, it’s 66. If you want to know, there are principal values bigger than bytes:
- Word – 16 bits
- DWord (Double Word) – 32 bits
- QWord (Quadruple Word) – 64 bits
Each of these values are used in basic machine code commands, and construct all the data you see on your computer. Now that you know this, you can either brag to your friends that you’ve just learned some pretty neat stuff about binary, or go sit in a fetal position waiting for the next part of How Computers Work, hoping it would be less confusing.