There’s an old joke among computer programmers: “There are essentially 10 types of people, those who understand binary numbers and those who don't”. (You might get this one a little later in the text)…
This article will move quickly. Its general intent is just to provide a quick summary of binary numbers and how they are used in digital devices (computers).
The word "binary" describes a numbering system that has only two possible digits. To understand this, let's first compare this to a system you're probably more familiar with -- the “decimal” system.
The word "decimal" describes a system that has ten possible digits. These are the digits 0 through 9. Every number expressed in the decimal system is a combination of these ten digits. You use the decimal system every day, it comes naturally, we all have 10 fingers and 10 toes (unless your family tree doesn't fork, but let's not go there), and some of us may use those 10 fingers and toes extensively to help with every day addition and subtraction.
The binary system works essentially the same way, with the only difference being that it only uses two digits. These are visually expressed by the digits 0 and 1 though it doesn’t necessarily have to be these particular two and can even be represented by a couple different sounds or colors or even voltage differences in an electronic circuit. Regardless, every number expressed in the binary system is a combination of two different indicators/digits in any combination and quantity.
Why do we need the binary system?
The binary system is essential to modern technology. The reason is that most electronic logic circuits are designed to have only two possible states, on or off, or higher voltage and lesser voltage. A simple example of this is the ceiling light in a room. The basic wall switch has only two options, on or off. This is an expression of a type of binary system. Another type would be the now largely obsolete Morse code system (still used in military and civilian short wave radio applications to this day). It also works with only two distinctive representations, an audible ‘dot’ or a ‘dash’ sound. Everything expressed in Morse code is done so with these two digits. Every sequence of these two signals has a certain meaning in the Morse code language. Likewise, every communication and function that takes place inside your computer uses a simple binary system as well which is based on the language of the binary number system.
How do binary numbers work? If you're not used to them, they may look pretty strange.
Here's an example of a binary number:
1 0 1 0 1 1 1 0
It is pronounced “zero one one one zero one zero one” and NOT “ten million, one hundred and one thousand, one hundred and ten”.
This is a single binary number and it can be converted to its decimal equivalent to become instantly recognizable to you. Converting binary numbers to decimal numbers is not that difficult if you know one of the few methods.
The first thing to know is that binary numbers are read from right to left. The second thing you need to understand is that each digit is based on a power of the number 2. If you remember high school mathematics it goes like this:
2 to the power of 0 equals 1 (20=1)
2 to the power of 1 equals 2 (21=2)
2 to the power of 2 equals 4 (22=4)
2 to the power of 3 equals 8 (23=8)
2 to the power of 4 equals 16 (24=16)
2 to the power of 5 equals 32 (25=32)
2 to the power of 6 equals 64 (26=64)
2 to the power of 7 equals 128 (27=128)
etc. ...
Do you see the pattern?
Let us now use these numbers to create a binary template. Remember again that binary numbers are always read from right to left:
128 64 32 16 8 4 2 1
Now I’ll place the binary number from our earlier example beneath this template:
128 64 32 16 8 4 2 1
1
0
1
0
1
1
1
0
Using this technique we now use simple multiplication and addition. If the binary number is a 1 it means this digit is ‘on’ or ‘true’ and we add the corresponding number from the template to our final conversion. If it is a 0 it means the digit is ‘off’ or ‘false’ and we do not add the corresponding number from the template above it.
In our example the digits for 128, 32, 8, 4 and 2 are true, so we add:
128 + 32 + 8 + 4 + 2 = 174
You could also express it as:
128*1 + 64*0 + 32*1 + 16*0 + 8*1 + 4*1 + 2*1 + 1*0 = 174
This means our strange looking binary number ‘10101110’ is the recognizable decimal number ‘174’.
(10101110=174)
Let’s explore ‘bits’ and ‘bytes’.
Now that we understand a rudimentary explanation of the binary system let's take a closer look at how a computer uses this system. Earlier we talked about 1 and 0 being the common representation used for binary digits. The term ‘Binary digits’ was soon abbreviated by engineers to a new shortened term called a ‘bit’. This term may sound familiar to you.
In our earlier example, we used the binary number 10101110. This number has 8 binary digits or 8 bits. I used this example specifically because in the computer/engineering world, whenever you have a group of 8 bits it was defined as a ‘byte’. 8 bits = 1 byte. 10101110 = 1 byte of information.
The reason we have to group bits at all is that if you are being fed a continuous stream of bits you would have no idea where one piece of information ends and the next one starts if you didn’t have some sort of system to break up this stream into understandable pieces. So if you agreed to receive and recognize groups of a defined length, e.g. a byte containing 8 bits, it's easy to group that long continuous stream of data into packets of eight bits and thereby interpret what each byte represents and eventually combine all these bytes of information to interpret the entire stream.
I hate to jump ahead too quickly but a good example of this that comes quickly to mind is how ASCII code (American Standard Code for Information Interchange) works. Any character you type on your keyboard is interpreted by your computer as a byte, an 8 digit binary number. For example, the keyboard letter "A" is expressed as the ASCII decimal code 65. But 65 being a decimal number cannot be interpreted by the electronics of your computer so it is converted to a binary number which is 01000001. These 8 digits, each one representing an ‘on’ or ‘off’ state of bit information, or one byte collectively, are known to your computer as the letter "A".
Each time you press a key a packet of 8 bits is corralled by the computer software and the binary data is translated into the representative key letter. As you type away, this stream of bits is continuously broken into 8 bit chunks (bytes) and each key is easily translated by the binary software. Soon an intelligent series of keystroke information is collected.
It is very important to know the difference between a bit and a byte because these two can get easily confused. One good example is monitoring data transfer speed. In the early days of computer hobbyists when you downloaded a file from the Internet or a Bulletin Board System through your modem, you probably noticed that your file transfer program indicated the transfer rate in KBps. Please note that the letter "B" is capitalized. This means the transfer rate was being shown in Kilo Bytes per second. This was common. For example, your download might have arrived at a rate of 3.5 KBps. Now, if you were using a 56K modem why was that rate so low? Shouldn't you have seen something closer to 56? No, because the 56K used back then was short for 56 Kbps. Note the lower case "b" means Kilo Bits per second. And since we now know that 8 bits equal one byte, we divide 56 by 8 and get a theoretical maximum of 7 Kilo Bytes per second. Software traditionally reported transfer rates using one system while marketers sold their modems using the bit method because the number was bigger and looked more impressive on the packaging to the uninformed shoppers of computer gear.
The same confusion arises in how hard drives, memory sticks and chips, iPhones etc. are marketed when informing buyers of the amount of data they're actually capable of holding. They of course hold exactly as much as they were designed to but how a salesman or marketer describes it on the box or in the store can sound grander if you describe the capacity in terms of bits instead of bytes.
One more slight aggravation is as follows:
You might be familiar with this scenario. "I bought an 8.4GB hard drive, but when I formatted it, Windows tells me that I have only 7.82 GB available. Did they sell me the wrong drive? How come it’s not 8.4GB like it says on the box?"
No, they sold you the correct drive and it is holding exactly as much as it was designed to do but it was not labeled quite correctly. The marketing department of the drive manufacturer simply doesn't know too much about bits and bytes or the binary system. To make it easier to calculate, they assumed that 1 KB is 1000 Bytes, 1 MB is 1000 KB, etc. That is wrong. So when they have a drive that can hold 8,400,000,000 Bytes, they just call it 8.4 GB and say “that's close enough for government work” (to quote an old common saying from Canada). But it’s not so. The multiplication factor is not 1000 since we're not using the decimal system, it is 1024 instead (2 to the power of 10. Simply extend the template above to see the succession to 1024). Computer components are designed with, and based on, the binary system of numbers not the decimal system. Engineers know this but office people and salesmen may not have in the early days of the industry.
To figure out the correct size of that drive, simply divide 8,400,000,000 Bytes by 1024 and you'll get 8,203,125 KB (kilo). Divide that again by 1024 to get 8,010 MB (mega). And once again divide that by 1024 to finally arrive at 7.82 GB (giga) which is the actual size of your hard drive in GB as reported by your operating system.
It’s just a error that probably occurred early on in the selling of computer hard drives but marketing experts soon figured out that the public either didn’t notice or were too uninformed to know how to account for it so it soon became one of those quirky industry traditions of the computer industry that works to the advantage of the seller in reporting a bigger capacity on its packaging and once again making everything look more impressive to the ever wanting public.
Let’s look at some other styles of binary systems.
A CD or DVD stores data using the binary system on a plastic disk. When writing data to a disk, the laser does nothing else than create a very, very tight spiral-shaped guide groove while burning the data as a long string of pits or not into a reflective dye layer or metallic film imbedded in the disk plastic. When the disk is later read, another laser follows the same spiral path and reads either a ‘pit’ where the light does not get reflected very well, or a smooth area called ‘land’ or ‘landing’ where the light reflects back very well. This system is nothing more but our good old binary system once again using two possible states: a pit or land. These are interpreted by the designed electronics of the device and computer to read or record data as a 0 or 1 in binary format.
Storing data on a magnetic media, most commonly hard drives inside laptops and desktop computers, also uses the binary system. In a very simplified explanation, each data bit gets stored on drive media as a tiny magnetic field. Each magnetic field has two poles, North and South. When the disk spins around and data is read by the read head, it finds the magnetic field projecting either a North/South or South/North pole alignment. Again, with only these two possible magnetic states the electronic circuit simply interprets these as a 0 or 1 respectively and then takes that data and assigns it a place within a binary system of information transmission.
You might have heard the term "bus" in connection with computers. A bus is a connection or channel between the chip set on a motherboard and the different parts inside a computer, such as the processor, memory, expansion cards, etc.
There is the processor bus which connects the chip set to the CPU, the memory bus which connects the chip set to the memory, local buses such as the PCI bus (Peripheral Component Interconnect), expansion buses such as the ISA bus (Industry Standard Architecture), and more. Please understand that my computer hobby has dwindled a bit and hasn’t been kept up too extremely in recent years so my use of terms may appear a bit dated to the more up to date enthusiasts reading this but the theory and function are still the same.
Each bus consists of two parts, the data bus, which transfers the actual data, and the address bus, which transfers information about where the data is supposed to go to.
Every bus runs at a certain clock speed, which is expressed in MegaHertz (MHz). For example, the old, now ancient I suppose, ISA bus ran at a whopping 8 MHz, the PCI bus ran at 33 or 66 MHz, the AGP bus ran at 66 MHz, etc.
Each bus also has a certain width which brings us finally back to our topic, because the bus width is expressed in bits, indicating how many bits can be transferred simultaneously over the bus. Think of turnstiles at a transit train station. Only a certain number of people can go through all the little gates at once, each in their own slot. Once through, another set of people can now go through. Physically, for computers, bus width defines how many ‘wires’ are in the bus. The ISA bus width ran from 8 to 32 bits, the PCI bus was either 32 or 64 bits wide, and the AGP bus was 32 bits wide. Naturally, this means the wider the bus, the more data can be transferred at the same time and the faster the bus is. More turnstiles at a train station gets more people through to the platform at a time than fewer would do.
Back in-the-day, the ‘clock speed’ and ‘bus width’ of the computer were commonly discussed at length by boring salespeople to glazed-eyed potential buyers at computer stores. By now computer industry design and technology has reached a level that produces machines where great speed isn’t an issue or considered a special ‘feature’ anymore. It is more a basic ‘given’ of almost all systems sold now. People now tend to focus more on the brand name, color, sleekness and style as choices for buying a computer. Good performance is assumed. We’ve become a superficial, fickle society maybe? Maybe not. The same could be said for the automobile legacy too I suppose.
The FAT
Back in-the-day you used to have to ‘partition’ the new, clean hard drive in your newly purchased computer as well, using quite a manual, hands-on process. The virgin hard drive was a blank slate and needed to be told how to organize its space and where to store future data and how much to store at each assigned location. One of the things you had to do was decide what file system to use. Initially and for many years afterwards FAT16 was the main file system for home PCs. It was a hard drive software system that was sophisticated enough for the technology of the time and could easily accommodate the existing drive designs in spite of the looming limits of its design. Its main limitation was that it could handle only hard drive partitions up to a size of 2 GB. The reason for this was that it used a 16-bit number to index each cluster. For years this wasn’t an issue as technology was producing hard drives with capacities much below this threshold.
Let's do some math to understand the difference between FAT (as FAT16 was known during those early years) and FAT32 (its later upgrade and replacement). When you partitioned and formatted the drive, it was being organized into a lot of cubby holes for data, so to speak. These are called clusters and are numbered by the FAT to keep track of them and what's in them. It’s very much like a gigantic Post Office.
FAT16 uses a 16 bit number to number each cluster. The highest number you can display using 16 bits is 2^16 = 65,535. The biggest possible size each cluster can be is 32,768 Bytes. Therefore, if you take the maximum number of clusters, 65,535, times the maximum cluster size, 32,768 Bytes, you get the maximum hard drive size that FAT can handle -- 2,147,450,880 Bytes, or 2 GB.
Once technology advanced enough to create hard drives larger than 2 GB a new FAT32 was soon created that uses a 32 bit number for each cluster and therefore, doing the math, can handle a drive up to 2 TeraBytes in size. As I write this, we’ve yet to produce hard drives this big for the common market but I've read of new advancements that may make them a reality very soon.
Anyway, this has been a small look at the binary system and its use. It is quite simple once you understand it, yet very powerful and certainly omni-present in our everyday lives in anything that has a circuit board inside of it. Even though this was just a basic overview, you hopefully now know a little more about how the binary system works and how important it is to the function of your television, laptop, smartphone or tablet computer.