Learn to count like a computer

Humans count in decimal, but computers count in binary. How does that work?

A recap of decimal

If you’re really ancient like me, you may remember a long obsolete technology known as “cassette tape”. You may even have seem an actual cassette player. And you may have noticed that they typically have a 3-digit revolution counter. For… some reason. (I think the idea is to allow you to fast-forward or rewind to specific points on the tape… except they’re way too inaccurate for that!) Older gas and electricity meters have a similar mechanism.

The way the counter works is quite simple. There are some number of plastic wheels, with the numbers from 0 to 9 printed on them. You zero the counter, so each wheel shows 0. And then the first wheel slowly rotates around, giving you 000, 001, 002, and so on. Eventually, the first wheel reaches 9. As the wheel continues to turn, it rolls back to 0 again. But a notch on the wheel causes the next wheel along to also rotate round one place, so instead of 009 being followed by 000 again, what actaully happens is 009 is followed by 010.

Continue reading “Learn to count like a computer”

Bottom up, Part I: Gates & multiplexers

Logic gates

Computers are built from logic gates.

Now, you might think that computers are built from transistors. But that’s not strictly true. Most current computers happen to be built from transistors. However, the very first computers were built from electromechanical relays, and after that they were built from thermionic emission valves (AKA vacuum tubes). And today, yes, they’re build from transistors.

People tend to think of computers as being these sophisticated, highly refined black box machines that mortal minds could never possibly comprehend. In fact, there’s no reason why you can’t have purely mechanical computers. You could make a working computer out of lego — but only if you can figure out how to make logic gates out of lego.

Continue reading “Bottom up, Part I: Gates & multiplexers”

How a computer works — the short version

You can get a rough appreciation for how a computer works just by grasping a small hundful of ideas.

1. Numbers flow along busses

Computers represent numbers using electricity. They do this by turning circuits on or off. For example, imagine you have a bundle of 4 wires, each of which can be independently turned on or turned off. Now, we could turn all 4 wires on. Or we could turn all of them off. Or we could turn the left-most one on and all the others off. Or we could turn the two outermost wires off and the two in the middle on. Or several other possible combinations.

Continue reading “How a computer works — the short version”