1.12

# Smaller and smaller switches

In a previous step you learned that we can perform calculations using 1s and 0s, and that the state of a switch can be used to represent a 1 or a 0. Now let’s take a look at how this concept developed into the modern computer.

A switch is just a device that can either allow electricity to flow through it, or stop electricity from flowing through it. The first switches used in programmable computers were called relays. These are electromechanical devices, so they consist of moving parts.

A relay is little more than an electromagnet attached to a normal switch. By using a current to turn the electromagnet on and off, you can turn the switch on and off. The Z3 was the first programmable computer to be built, in 1941, and contained 2000 relays. It was capable of executing about 5-10 instructions per second, which is pretty slow in comparison to modern computers that have clock speeds in the billions.

After the relay switch came the triode, or valve (in the UK). These devices had no moving parts, which meant that they could act as switches much faster. A triode consists of an evacuated glass tube, into which two electrodes are inserted, separated by a grid. One of the electrodes is heated up, and emits electrons. These are attracted to the other electrode, which is positively charged. This completes the circuits and allows currents to flow. However, if the grid between them is negatively charged, it will repel some of the electrons, preventing them from reaching the second electrode and stopping the current.

The first computer to use these valves was the Colossus, built in 1943. The problem with valves, though, was that just like light bulbs, they could “blow” and need to be replaced.

Following on from valves came the invention of the transistor. Made from semiconductors, these components could again act like switches without having any moving parts, and were very hard wearing. They could also be manufactured to be very small, meaning a lot of transistors could be combined together. Transistors are the basis for all modern day computers.

A transistor has three terminals – the base, the collector and the emitter. A small current at the base of the transistor can allow a large current to flow between the emitter and the collector. This allows transistors to act like tiny little switches.

You can see a transistor in operation in this simulation.

You don’t have to understand the circuit, but just notice that the transistor is enabling the button to do the opposite of what you might normally expect. When the button is off, the LED is on. When the button is clicked, it turns the LED off.

Think about this in terms of a Turing Machine, and you might start to understand how transistors can be used to build computers.

Imagine a Turing Machine where we are only using two cells on the tape. The program might be as follows:

State Symbol Write Move Next State
A 1 None Right B
0 None Right C
B 0 0 Left Halt
1 0 Left Halt
C 0 1 Left Halt
1 1 Left Halt

If the first cell is a 0 (the button is off), the machine would write a 1 in the adjacent cell (turn the LED on). If the first cell is a 1 (the button is on), the machine would write a 0 in the adjacent cell. (turn the LED off).

This is only with a single transistor, but with more transistors you can create some incredibly complex instructions. The binary addition Turing machine you looked at earlier can be created with a handful of transistors. The question is, how many transistors does it take to build a modern computer?

You can still get regular-sized transistors today that can be a few millimetres to a few centimetres in size. However, modern technology has enabled us to shrink the size of a transistor down to microscopic sizes.