Open the door of your microwave oven and look at the back wall. Behind it sits a vacuum tube, the same family of device that ran every radio, television, and computer on Earth until the late 1950s. It is called a magnetron, it puts out about a kilowatt of radio energy to heat your dinner, and no transistor made today can do that job as cheaply. Now go and start your car. The click you hear when you turn the key is a relay, and so are the switches behind the headlamps, the horn, and the fuel pump: a device older than the vacuum tube, older even than the light bulb, still doing the job because nothing has beaten it at that job.

I have wanted to write this series for a long time. Jon Stokes's book Inside the Machine is the thing that taught me how a processor actually works. It starts with nothing more than a light switch and ends with the real chips of its era, the Pentium 4 and the PowerPC G5, and by the end you can read a spec sheet and understand what every line means. It is also, by design, a book about the CPU. The GPU gets a passing mention. This series is my attempt at the same journey for the graphics processor, from the switch all the way up to Nvidia's Ada, Hopper, Blackwell, and Vera Rubin. No prior electronics needed. If you have read ML Basics or LLM Basics, you already know the one calculation we will follow the whole way: the neuron's w × x + b, a multiply and an add. A language model does trillions of those per second. The question this series answers is how a slab of silicon manages it.

Stokes's first switch is the transistor. I want to begin one step before it, with the two devices that did the transistor's job before the transistor existed, the relay and the vacuum tube. The transistor only makes sense as an answer to their problems, and both of them are still all around you, doing the jobs where they were never beaten. But before any of that, it is worth being clear about what we are trying to build.

What a computer is, in the simplest terms

Strip a computer to the bone and it is a machine that takes in numbers, combines them by following a list of instructions, and puts numbers out. The numbers can stand for anything: a price, the colour of a pixel, the weight w in our running calculation. The instructions are things like "add these two", "compare these two", and "if the first was bigger, do this next instead of that". Everything a computer has ever done, from a payroll to a video game to a chatbot, is an enormous number of those small steps done very fast.

The trick that makes such a machine buildable at all is to write every number using only two symbols. Instead of the digits 0 to 9, use just 0 and 1, and let a wire that carries a current mean 1 and a wire that does not mean 0. Part 4 goes through this properly. For now the point is what it buys you: once every number is a pattern of on and off, every operation the computer performs becomes a question about switches.

Side note: what a real chip calls 0 and 1. In this part's circuits, 0 really is no current at all, because a relay's contacts leave a physical gap. In a modern chip nothing is ever simply absent. Every wire is actively held at one of two voltage levels, one near zero volts and one near a volt, and the circuit reads anything close to the bottom as 0 and anything close to the top as 1. Two well-separated levels are used, rather than presence and absence or ten different levels, because electrical noise can nudge a voltage a little and the reading still comes out right. [Part 3](/ai-arena/inside-the-gpu/03-the-switch/) comes back to this.

+ battery lamp, off switch, open one switch, open: the lamp is off there is a gap in the loop, so no current flows. the lamp shows 0. battery lamp, on switch, closed one switch, closed: the lamp is on the loop is complete and current flows all the way round. the lamp shows 1. One switch and one lamp is one bit. battery lamp, off open closed two in series, one open: the lamp is off one open switch is enough to stop the current through both. it lights only if both are closed. This is AND. battery lamp, on open closed two in parallel, one open: the lamp is on the current only needs one path, and the closed switch gives it one. it lights if either is closed. This is OR.
A computer's whole vocabulary, in switches. The switches are red, the wire is black, and green dots mark where current flows. The two parallel bars are the standard symbol for a battery, with the long bar its positive terminal and the short thick one its negative. The gap between the bars is inside the battery, not a break in the wire.

Look at the four circuits above. The first two are the same circuit with the switch open and then closed: a single switch and a lamp is one bit, and the lamp shows whether the switch is on. The last two both have one switch open and one closed, and they disagree about the lamp. Put two switches in series on the same wire and the lamp lights only if both are closed, which is the logical idea AND, so one open switch is enough to keep it dark. Put them on parallel branches and it lights if either is closed, which is OR, so one closed switch is enough to light it. Add a switch that is arranged to be on when its input is off, which is NOT, and Part 4 shows that those three arrangements, repeated, will add two numbers, compare them, and remember the result. That is a computer. Everything else is quantity.

There is one catch, and the whole of this part hangs on it. In the circuits above, the switches are closed by a finger. That is fine for answering a single question once. But think about what even a simple instruction like "add these two numbers, then compare the result with a third" asks for: the comparison has to start from the answer of the addition. If a person had to read the answer off a lamp and press the next switches by hand, the machine would compute at the speed of a person, which is no machine at all. So the lamp at the end of one arrangement has to be the finger on the next. The output current of one group of switches must itself flip the switches of the next group, and that group's output must flip a third, thousands of stages deep, with nobody anywhere in the chain. In place of every finger there has to be a switch that a current can flip. The drawing below is the whole requirement in one picture, with the missing component as a dashed box.

both closed: the AND says yes ? lamp stage one: two switches in series, an AND a switch that current itself can flip stage two starts from stage one's answer, not from a person reading a lamp
The requirement that defines the whole of computing hardware. Stage one's output current must close stage two's switch on its own. The rest of this part, and the next two, are about what can sit in the dashed box.

One circuit controlling another, three ways

Set the computer aside for a moment and look harder at the dashed box, because "one circuit controlling another" turns out to be wanted far beyond computers, and in three distinct ways.

1. control an equal circuit: logic a small current the active device an equal current next stagenext stagenext stage what a computer needs: stages chained without limit 2. a tiny current commands a huge one: power a whisper, 0.2 amps the active device 200 amps to a starter motor what a car, a lift, and a heater need 3. control by degrees, not on and off: amplification a faint signal the active device the same shape, much stronger radio, telephone, music
Three uses of the same trick. The red side decides, the blue side is what actually flows.

The first way is the computer's, and it is the dashed box exactly: the two circuits are equals, the point is only that the decision is made by a current rather than a finger, and the prize is that stages can be chained without limit. The second way is about power. The controlling current can be thousands of times smaller than the controlled one, so a thin wire carrying a gentle signal can command something fierce, which matters everywhere machinery meets electricity. The third way drops on-and-off altogether. Let the big current follow the small one by degrees, rising and falling in step, and the device is no longer a switch but an amplifier: a signal from an aerial too faint to hear, or a voice grown weak over a hundred miles of telephone wire, comes out the other side as the same shape, only strong. A component that can do these things is called active, and there have only ever been three families of them. The relay, which can switch but never amplify, since its contacts are open or closed with nothing in between. And the vacuum tube and the transistor, which can do all three.

Side note: the passive components. Everything else on a circuit board is passive: it shapes, stores, or resists current, but it cannot make a small signal control a large one. There are three that matter. A resistor restricts the flow, the way a narrow pipe restricts water, and is what stops an LED from drawing so much current that it burns out. A capacitor stores charge briefly and gives it back, like a small tank with a spring-loaded lid, and is what smooths the lumpy output of a power supply and what a camera flash charges up before it fires. An inductor is a coil of wire that resists changes in current, and is the heart of every transformer, including the one inside your phone charger. A circuit made only of these three can filter, delay, and tune, which is how the earliest radios selected a station, but it can never amplify. For that you need one of the three active devices, and this part and the next two are about them.

The light switch, and the finger problem

Start with the switch on your wall. It sits in the same loop of wire as the lamp: the current that lights the room passes through the switch itself, and the thing that decides whether it flows is your finger, which is outside the circuit altogether. That is fine for a room. It is useless for a machine, because a machine has no finger. What we want is a switch whose "finger" is another electric current, so that one circuit can decide what happens in a second circuit.

The relay is exactly that, and it is the oldest device that does it. It is an electromagnet placed next to a switch. Run a current through the coil and the iron core becomes a magnet, which pulls a hinged iron arm, the armature, towards it. The arm carries a contact, and when it moves it closes a gap in a second, completely separate circuit. Stop the current in the coil, the magnet dies, and a spring pulls the arm back, opening the gap again. The coil circuit is the controlling circuit, the contact circuit is the controlled circuit, and the only thing that passes between them is the pull of a magnet.

coil off gap, about 1 mm no current, no magnet spring holdsthe arm up coil on current in the coil: the core is a magnet contacts touch spring stretched,arm pulled down a tiny spark, every time the trip down and back takes 5 to 10 milliseconds, so a few hundred flips a second at most
The mechanism, off and on. The coil magnetises the core, the core pulls the iron arm through about a millimetre of air, and the spring pulls it back. Keep the millimetre and the milliseconds in mind, because they come back as the relay's great weakness.

The drawing below places that mechanism in its two circuits, next to the light switch it replaces. Hold onto the right-hand panel, because every strength and every weakness of the relay is visible in it: the red circuit that decides, the blue circuit that flows, and the air gap between them.

a light switch: your finger is the control batteryfinger, outside the circuitlamp a relay: a current is the control controlling circuit, a small current controlled circuit, a big current coil on aniron core armature (iron arm) pivot spring contacts, open (the air gap) lamp
Left, the switch you know: the decision is made by a finger. Right, a relay: the decision is made by a current in the red circuit, and it closes the blue one. Nothing but magnetism crosses between them.

Where the relay came from: the telegraph

The relay was invented in the 1830s to solve a problem with the telegraph, and the telegraph is worth a moment because it is the first machine that sent information as on and off.

A telegraph is a battery, a switch, and a very long wire. The switch is the key, a lever the operator presses with a finger. At the far end, the wire runs through an electromagnet with a small iron arm above it, the sounder. Press the key and current flows down the line, the electromagnet pulls the arm down with a click, and when the key is released the arm springs back with a second click. A short press is a dot, a long press is a dash, and Samuel Morse's code turns dots and dashes into letters. The circuit is completed through the earth itself, with a metal plate buried at each end, so that only one wire has to be strung. It is the light-switch circuit from the last figure, with the lamp replaced by a clicker and the wire made forty miles long.

the telegraph: a switch, a battery, a long wire, and a clicker key: a switchearth plateearth plate the line: one wire, miles of it, the earth is the return sounderclicks · − · dots and dashes too far for one battery: put a relay in the middle a weak current, worn down by miles of wire works the relay relay contacts connect a fresh battery to the next section on to the next town
The telegraph sent information as on and off, a century before the computer. The relay let it go further than one battery could push.

The problem was distance. A wire resists current, and after a few dozen miles the current arriving at the far end was too feeble to pull a sounder's arm with a satisfying click. Joseph Henry is usually credited with the answer, around 1835. Make the electromagnet at the far end pull a very light, very sensitive arm, and instead of clicking, let that arm close a contact that connects a fresh battery to the next section of line. The weak signal arriving from the west does not have to push the current all the way east. It only has to flip a switch, and the fresh battery does the pushing. The message relays itself onward, station by station, which is where the name comes from, and what has been built is a switch flipped by a weak current that controls a strong one.

That is the whole relay, and by 1837 it was in the telegraph patents of Edward Davy and Samuel Morse. A century later, people noticed that the same device would do for the AND and OR of the first figure, and built computers out of it.

What "switching enormous currents" means

The relay's first virtue is the one the telegraph needed: the current that flips it can be tiny, and the current it controls can be as big as you like. To see why that matters, it helps to be clear about what current is. Current is the rate at which charge flows through a wire, measured in amps, and you can think of it as litres per second in a pipe. A phone charger pushes about two amps into a phone. A kettle draws around ten. The starter motor that turns over a cold car engine draws somewhere between one and two hundred amps for a few seconds, and a big current has consequences. A wire carrying it has to be thick, or it heats up, which is why the cable from your car battery to the starter is as thick as your finger. And a switch that opens while a big current is flowing draws a spark, an arc, across the opening contacts, which pits and eventually welds them.

Now imagine that starter switch was the key in your dashboard. A finger-thick cable would have to run from the battery, up through the steering column, to a switch under your hand, and back, and every start would arc inside it. Instead, the key switches a fifth of an amp, through a thin wire, into the coil of a relay bolted next to the battery. The relay's contacts, which are heavy copper built for the job, carry the two hundred amps over a few inches of cable to the motor. The thin wire and the small switch decide. The thick wire and the big contacts deliver.

starting a car: a small current decides, a big current delivers M 12 V ignition key, on the dashboard thin wire, about 0.2 amps, metres long relay coil relay, bolted next to the battery starter motor, 150 to 200 amps car battery finger-thick cable, a few inches long heavy contacts
The click you hear when you turn the key is this relay closing. The thin red circuit is the finger. The thick blue one is the muscle.

The same arrangement is behind every headlamp, horn, and fuel pump relay in the car, the contactor that starts a lift motor or an air conditioner's compressor, and the relay boards inside industrial machinery, where a control computer with wires the thickness of a hair switches motors that draw hundreds of amps.

Keeping the dangerous side away

The relay's second virtue looks, at first glance, like the first one again, a small circuit in charge of a big one. It is not about size at all. Go back to the drawing of the relay beside the light switch, the one with a red circuit and a blue circuit, and notice something the starter example did not need: the two circuits share no wire. The only thing that passes from one to the other is a magnetic field across an air gap, and that would matter even if the two currents were exactly the same size. Engineers call this isolation, and it is what lets a delicate, low-voltage circuit board control something that would destroy it on contact.

The mains supply in your house is 230 volts (120 in North America), which is enough to kill a person and far more than enough to destroy a microchip. Take a thermostat as the concrete case. On its circuit board is a small chip that decides when the room is cold, it runs on three to five volts, and one of its pins can supply a few thousandths of an amp. It cannot switch a boiler directly. So that pin drives the coil of a relay, with a few volts and a few milliamps, and the relay's contacts, on the other side of the gap, carry the mains to the boiler. A washing machine's controller does the same to switch its heating element and drum motor, and a smart plug does it to switch whatever you plug into it. If the mains side arcs, spikes, or shorts, none of it reaches the chip, because there is no wire for it to travel along. The relay is a wall with a magnet in it.

isolation: a thermostat switching a boiler microchip circuit board, 5 volts, safe to touch a few milliamps from one pin only magnetism crosses this line mains, 230 volts boiler element, 10 amps dangerous side: nothing here can reach the chip
Inside a thermostat. The chip on its board decides when heat is needed, the relay's contacts switch the boiler's mains supply, and the mains never touches the board. A washing machine controller and a smart plug are the same picture with a different load on the right.

There is a third virtue, less obvious. When a relay is off, it is off: a physical air gap, not a component that merely conducts very little. For a safety interlock, the door switch on an industrial press, the cut-out that isolates a faulty power line at a substation, that certainty matters, which is why the boxes that make those decisions are still called protective relays even now that most of them are computers inside.

Why it is slow, and why it wears out

Now the weaknesses. Go back to the coil-off and coil-on drawing near the start of this part, because both of them are in it. To close the contacts, the relay has to move a lump of metal: the magnet must pull the armature down through the air gap, which is about a millimetre, and the spring must pull it back. Iron has mass, and moving it takes time. A small relay operates in five to ten milliseconds, so it can switch at most a few hundred times a second, and a big one is slower.

Every closing bounces the contacts a little and every opening draws that small arc, so the contacts pit, roughen, and after a few million operations stick or fail. A relay is the size of a sugar cube at best, because the coil needs turns of wire and the armature needs room to swing. It draws a steady current the whole time it is on, to hold the arm against the spring. And it is either open or closed, nothing in between, so it can switch a signal but cannot strengthen one: it is useless for a radio or a telephone.

People did build computers out of them, because the AND and OR of the first figure are exactly what a relay's contacts do, and a relay's coil can be driven by another relay's contacts, which is the "no finger" requirement met. Konrad Zuse's Z3 in 1941, the first working programmable computer, used about 2,600 relays and could manage a multiplication in three seconds. The Harvard Mark I in 1944 ran on 3,500 relays and could be heard from the next room. And the most famous computer bug was literally a moth, crushed in a relay of the Mark II in 1947 and taped into the logbook as the "first actual case of bug being found", which was a joke, because engineers had been calling faults bugs since Edison. A relay computer is a wonderful thing to listen to and a hopeless thing to scale: at a few hundred operations a second, our running calculation w × x + b would take most of a second, and a modern GPU does tens of trillions of them in that time.

Where this leaves us

A computer is switches arranged so that the output of one group flips the input of the next, and for that you need a switch that electricity itself can flip. The relay was the first. A small current in a coil pulls an iron arm and closes a separate circuit, and that separation is the source of everything it is good at: a fifth of an amp at the ignition key commanding two hundred amps at the starter, a five-volt chip switching a mains heater without the mains ever touching it, and an air gap that is truly open when it is open. It is also the source of everything it is bad at. An arm has to move, so the relay is slow. Contacts spark, so it wears. A coil needs turns of wire, so it is big. And it is only ever open or closed, so it can switch a signal but never strengthen one.

Zuse and Aiken built real computers from relays and proved the idea. At a few hundred operations a second, though, the idea was all they could prove. The next part is about the device that could do the relay's job a thousand times faster and could also do the one thing the relay never could, make a faint signal strong. It was found by accident inside a light bulb.


Next: The Vacuum Tube: from Edison's lamp to the diode and the triode, what a one-way valve is for, the machines the tube built, why it could never be small or cool enough, and how the transistor fixed exactly those problems.