##### Jun 6, 2016

## 8 bit video games, 64 bit servers, and How to Count to Infinity

Written by Katie Gomez

These technical terms have made their way into popular culture. Let’s make sure everyone knows what they mean.

## What is a Bit?

A bit is a single 0 or 1. You can string these together to make bigger numbers.

8 bits is enough to count from 0 to 255. Or from -128 to 127. We usually call 8 bits a “byte.” When computers mostly spoke English, one byte was enough space to hold a single character. That’s a single letter, digit, or punctuation mark.

16 bits is enough to count from 0 to 65,535. Or from -32,768 to 32,767. Notice that we doubled the number of bits but we squared the number of possibilities. 8 bits can represent any of 256 possible values. 16 bits can represent 65,536 possible values. 8 + 8 = 16. 256 * 256 = 65,536. In Microsoft Windows 16 bits was often called a “word,” although there are issues with that terminology. Sometimes international alphabets use 16 bits for each character, however that leads to some issues.

32 bits will let you count from 0 to a little over 4 billion. Again we doubled the number of bits and squared the number of possible values. Modern Linux systems use 32 bits per character when storing international text. There are tricks to use less space sometimes, especially when saving to disk or talking over a network. But The Unicode Standard recognizes more than 65,536 unique characters used in various human languages, so we need more than 16 bits. Also, it takes 32 bits to store a traditional network address, like 127.0.0.1.

64 bits will let you count from 0 to 18,446,744,073,709,551,615. That’s a big number! What do we need that for? 32 bits are enough to talk about most things in the real world. However, the computer itself is a complicated thing. Usually we need a computer with “more bits” so the computer can organize its own thoughts. More about that in a moment.

128 bit numbers are used in newer network addresses. Why? The short answer is that 32 bits wasn’t enough and we’re running out of the old addresses. If we handed these addresses out one at a time, like numbers at the deli, 64 bits would be sufficient. But it’s more convenient to give out large blocks of network addresses at once. So most of these numbers will never be used. We also use 128 bit number for universally unique identifiers. It’s not always practical to have one person, computer, or organization give unique names to everything. Instead it’s common practice to make up a random 128 bit number each time you need something unique. There are so many 128 bit numbers that there’s almost no chance two people will pick the same number.

## Numbers have sizes?

What do I mean by the size of a number? Let’s forget about computers for a moment. Let’s think about a normal person with a pencil and paper.

What if someone asked you to multiply 923 x 847? Most of you would need to take a few moments and write things down.

What if someone asked you to multiply 6 x 5? Most of you would quickly shout “30.” That’s like one of those fake IQ tests that make their way around Facebook. People click “like” on those stupid things because they know the answer instantly, before they have a chance to think.

Clearly 2,932 x 9,931 is harder than any of the problems we’ve mentioned so far. But what about 1 x 1 or 9 x 9? Those last two problems are both exactly as easy as each other. 9 is larger than 1, but it doesn’t matter. You memorized the answer to those problems long ago and in both cases you spit out the answer instantly.

You are good at doing math for numbers between 1 and 9. That’s automatic for most of us. When we get a bigger problem we have to do something more complicated. We break that down into smaller problems, involving number between 1 and 9. We use the pencil and paper to keep track of the various pieces of the problem.

## How Fast Can You Multiply?

Performance is vital when building or programming computers. That’s why we care about these problems. The faster the computer the more it’s worth. These math problems are samples of the type of work that computers do all the time.

Look at these two math problems. The first problem is to multiply two 2 digit numbers, and the second problem is to multiply two 4 digit numbers. The second problem will take more than twice as much effort. In fact, the second problem will take about four times as much effort.

But the same rules don’t apply to the really simple problems. Multiplying two 2 digit numbers is much, much harder than multiplying two 1 digit numbers. It’s a lot more than four times as hard. We are just really good at multiplying 1 digit numbers.

An 8 bit computer is a computer that can add, subtract, multiply or divide 8 bit numbers very quickly and easily. It could do math on bigger numbers, but it would have to break the problem into smaller pieces, like we did in the two problems above. A 64 bit computer is a computer than can do the same math on 64 bit numbers, all in one step.

A lot of things drive the speed of a computer. If a computer is constantly running into problems that are small enough, it will solve each of them quickly, in a single step, then move on to the next one. If a computer is too small, or the problems are too hard, the computer will have to do a lot more work for each problem. The result is that the computer will be slower.

Did you try to solve some of the harder math problems listed above? Did you make funny faces while you were doing them? Did you grumble and complain? That’s what an 8 bit computer feels like when it tries to work with numbers bigger than 255. Do you really want that computer working for you?

## Memory

We’re talking about problems that the computer needs to solve. What are these problems? You might ask your computer to do big things, like playing a YouTube video or posting a picture to Facebook. But that gets broken into a lot of smaller tasks. One of the most basic tasks is to read from memory. A number in the computer often refers to a location in memory. Reading from that location has to be very fast.

What if your computer only has 8 bits to describe memory? You can only remember 256 things. And each of those things is typically a single byte. That’s not powerful enough that you’d recognize it as a computer. That could maybe control a simple motor.

The Apple II was an 8 bit machine; it could quickly and easily work with single bytes. But you could add up to 64 kilobytes of memory to that machine. That means it takes two bytes (16 bits) to describe a single location in memory. That means you have to jump through some hoops to access memory. https://en.wikipedia.org/wiki/SWEET16 describes some of the neat tricks Steve Wozniak added to the Apple II to make the process easier, but slower.

That issue keeps repeating itself. The original IBM PC was a 16 bit machine. It could easily access 64k of memory. But a PC was typically loaded with 16 times that much memory. So if you wanted to use all that memory, the programmer had to jump through some hoops. And, of course, even if you could access all that memory, most people decided that wasn’t enough. That’s the biggest reason we had to move up to 32 bit machines.

Microsoft Windows didn’t really take off until the Intel 80386 came out. There were multiple reasons for this. But the short version is that it took a 32 bit machine to make Windows practical. The older PCs didn’t have enough memory to run multiple programs at once.

We jumped from 32 bit machines to 64 bit machines for the same reason. We needed more memory. If you need more than 4 gigabytes of RAM in your computer, you need a 64 bit machine. This started with the server market, where one server would handle many users at once. It’s possible to run Windows 10 with less than 4 gigabytes, but I wouldn’t recommend it.

## How to Count to Infinity

We’ve discussed some places where larger number are helpful or essential. The next one is my favorite.

Sometimes you need a unique way to name the items in your program. The simplest way is to use a number. The first item is 1, the second item is 2, etc. (0 is reserved for special purposes.) But what happens when you run out of numbers?

We’d like to use a single number to refer to each item. As I said before, each computer is good at working with numbers of a certain size. You can make something bigger by putting together two or more numbers, but that’s slower and and more difficult.

Another thought is to reuse numbers. You assign the number 2 to an item. Later, when you’re sure that item will never be needed again, then you can reuse 2 for the next item. Often that works. Do you remember the last time you got a new phone number? Did you ever get a call for the last person who had that number? It’s not a perfect solution.

Now that we have 64 bit numbers, something interesting has changed. If you use 64 bit numbers for your counter, you will never run out of numbers.

Never? Pretty much. Most modern CPUs have topped out around 2 GHz. That means if your computer did nothing but count, it would take about 100 years before it ran out of 64 bit numbers. Of course any interesting program would do a lot more than just count, so it would take a lot longer to run out of numbers. Can you imagine writing a program and letting it run for over 100 years before you had to restart it? If your machine was that fast but you only had 32 bits, you’d run out of numbers in about one second. So you can’t use this trick on a 32 bit machine.

## What’s All That Mean?

If someone asks you what’s cool about an 8 bit video game, there are lots of of answers. Modern programmers are impressed that anyone could make those old computers do anything.

If someone asks how big a 64 bit number is, we could give lots of answers. My favorite is that you can count (virtually) forever without ever running out of numbers. If you have a 64 bit computer, this trick works very well. Counting to infinity sounds really cool. And, if you understand what’s going on, it really is that cool!