Code by Charles Petzold

I used to ask my friends how computers work. Almost everyone I know studies computer science, so you’d think someone could tell me. No one did. I’ll give them the benefit of the doubt and assume they knew the answer and just didn’t want to explain it to me. This book – one of the best books I’ve read in a while – explains it quite well, all the way down to the electrons.

1) SOS is 3 dots, 3 dashes, and 3 dots in Morse code.

SOS doesn’t stand for anything and translates directly into Morse code. The first four notes of Beethoven’s Fifth symphony spells V.

2) Electron and electricity both derive from the Greek word for “amber.”

The ancient Greeks saw that rubbing amber with wool produced static electricity.

3) A relay uses an electromagnet that moves a metal strip when there is current.

This metal strip acts as a switch to connect the input and output. This idea that a switch could be turned on and off by a current is a founding block of the computer.

4) The black and white strips of a barcode represent bits.

The UPC is a series of 95 bits. There are the left, center, and right guards to orient the barcode. The remaining bits correspond to 12 digits (6 on the left and 6 on the right of the center guard). Each digit is 7 bits long. The first digit is the number system character (regular UPC/variable weight item/coupon). The next 5 digits represent the manufacturer. The next 5 digits represent the code for that item for that particular company. The last digit is the modulo check character.

5) One way to represent negative integers is to use two’s complement.

In binary, this involves inverting all bits and adding 1. Under this procedure, the leftmost bit is the sign bit and subtraction is just addition. While unsigned 8 bits normally represent 0 to 255, signed 8 bits represent -128 to 127.

6) Early computers used relays. Then came vacuum tube computers, which were eventually replaced by computers built with transistors.

At the time, vacuum tubes were a significant improvement over relays because tubes could switch in a microsecond, compared to a millisecond for relays.

7) Semiconductors have 4 electrons in their outer shell and can be doped to make them into negative or positive semiconductors.

An NPN transistor has 2 N-type semiconductors, with 1 P-type semiconductor sandwiched in between. The three pieces are called the collector, the base, and the emitter. Somehow, I had completely forgotten what semiconductors were. To the point where I didn’t even register that they were elements. High school was a long time ago. 3.091 was also a long time ago.

8) In 1971, Intel came out with the first “computer on a chip” (microprocessor) – the 4004.

The 4004 was a 4-bit microprocessor with a clock speed of 108 KHz and 640B RAM. If I’m doing the comparison correctly, most mainstream laptop processors now are 64-bit with a clock speed of x GHz and x GB RAM. I never knew how to read any computer specs before. This book at least gave me a starting point.

9) CR stands for Carriage Return and LF stands for Line Feed.

CR moves printing to the left of the page, and LF moves printing down one line. My first encounter with these codes was not pleasant. Due to some differences in how Windows and Linux use them, I had a fun time cleaning GB-sized CSV files.

10) UNIX was born out of Bell Labs, which was a subsidiary of AT&T. Because of anti-monopoly policies against AT&T, the company could not market UNIX and had to license it to others starting in 1973.

The rest is a moshpit.

I learned so much from this book I probably could have another list of 10. Some concerned things I encounter daily that I really should have known. For example, I never thought about why hexadecimal colors had the letters ABCDEF. Or why Silicon Valley is called Silicon Valley. Or what Stack Overflow refers to. Others were much more technical. This book steps through circuits and gates and adders and latches and selectors, etc. It became too difficult to follow and to trace what’s happening in each piece of the hardware. But that only made me appreciate how complicated yet simple computers are. It’s all electrons and 0s and 1s. The magic is in the billions and billions of calculations.


Leave a Reply

Your email address will not be published. Required fields are marked *