This document is an addendum to the book ‘How Computers Work: Processor and Main Memory’ and continues that explanation to cover improvements to that simple computer.
In that book, transistors were occasionally mentioned. An n-channel transistor works like a normally open relay. Below is a picture of an n-channel transistor.
The n-channel transistor is in the upper left of the picture and consists of two ‘n-doped connection pads,’ a layer of glass, and a layer of metal. A normally-open relay has four connections: an input on the left which corresponds to the n-doped connection pad on the left above, an output on the right which corresponds to the n-doped connection pad on the right above, an electromagnet connection that controls whether the input and output wires are connected which corresponds to the ‘layer of conductor (metal)’ in the diagram above, and a connection from the electromagnet to ground which corresponds to the ‘strongly p-doped connection pad’ that is connected to ground in the diagram above.
N-doped silicon has one type of impurity and p-doped silicon has another type of impurity. Though pure crystalline (The silicon above is a crystal.) silicon is an insulator, adding n or p doping makes it a conductor. However, where n-doped silicon and p-doped silicon meet, a layer of silicon becomes insulating. To make sure that those junctions of n-doped and p-doped silicon stay an insulator, the p-doped part is connected to ground through the strongly p-doped connection pad. (Where strongly p-doped and lightly p-doped silicon meet there is NO insulation.)
No electricity can get from the n-doped connection pad on the left to the n-doped connection pad on the right because, where n-doped silicon meets p-doped silicon, there is an insulating layer. No electricity can get from the layer of metal (called the gate) to anywhere because of the layer of insulation under the layer of metal.
However, when the gate (the ‘layer of conductor (metal)') is connected to power (the top of the battery (or batteries)), then the gate becomes positively charged compared to the substrate, which is connected to ground (the bottom of the battery) through the strongly p-doped connection pad. The gate then attracts electrons from the substrate and n-doped connection pads into the lightly p-doped silicon just under the layer of insulation. This makes the silicon under the layer of insulation act like it was n-doped and electricity can flow from one n-doped connection pad to the other just like electricity can flow from left or right (or right to left) through a relay when the electromagnet is connected to power.
When the gate is connected to ground, electricity can NOT flow under the insulating layer under the gate. The gate should be connected to power or ground. If the gate is connected to power and then connected to nothing, it will stay charged for a short while at least and the transistor will continue to conduct, but after a while, small leaks of current may change its value to ground. This can take very roughly a millisecond (a thousandth of a second). Similarly, if the gate is connected to ground and then connected to nothing, it may change after a short while.
As a last comment on n-channel transistors, the n-doped connection pads are often called the ‘source’ and the ‘drain.’ Which is called which depends on what they are connected to in the circuit.
A p-channel transistor acts like a normally closed relay. A p-channel transistor is just like an n-channel transistor except that all ‘p’ doping is replaced by ‘n’ doping and all n doping is replaced by p doping. Also, the connection to ground is replaced by a connection to power. Furthermore, when the gate is connected to power, NO electricity can flow under the gate, but when the gate is connected to ground, electricity can flow under the gate.
Obviously, the smaller you can make transistors, the more transistors you can put on a chip. Chips can only be made so big because pieces of perfect crystal are only so big. However, there is another reason that there has been so much effort and money expended to shrink transistors. The smaller one makes transistors the faster a circuit is that is made with those transistors. That is because a transistor shrunk in its width and length dimensions by a factor of 10 can carry as much electrical current (charge (electrons) per second) as its larger twin! That’s because it’s easier to push electrons through a shorter gap under the gate. However, it only takes a much smaller charge to operate the smaller transistor (or charge wires between the transistors). Therefore, the circuit with the smaller transistors is much faster. A circuit with the length and width of transistors (and wires) shrunk by 10 will have its speed increased by a factor of perhaps 10.
That is all that will be written about transistors (for now, anyway).
It takes about twice as many transistors to make a circuit than it takes relays to make a circuit but transistors are vastly superior. This is because transistors are billions of times smaller, millions of times cheaper, billions of times faster, vastly more reliable, and use only a tiny fraction of the electrical power to do a calculation. Therefore, for a 64-bit computer like the one in the book with a lot of memory, you can make the computer a billion times smaller, for a millionth of the cost, a billion times faster, vastly more reliable, and using only a tiny fraction of the electrical power if you make it with transistors instead of relays.