Inside your computer (part 1)


#1

When you program, you give the computer instructions in Python or Javascript or another programming language. But these instructions are not what the computer executes. Using programming languages, it is easy to forget that a program’s instructions are translated into much more basic commands.

The simple instructions for the processor

Processors can only execute simple instructions. Instead of loops and conditionals for example, the processor can handle pointers. Specifically, the program counter indicates which instruction to execute next: it points at the upcoming part of the program. For example, the following loops in Python and Javascript are equivalent.

for i in range(3):
    x += i
print(x)
for(var i=0; i++; i<3){
    x += i
}
console.log(x)

When they are executed by the processor, the instructions look more like this:

i = 0
LABEL loop_start
x = x + i
i = i + 1
condition = i - 3
IF condition IS ZERO THEN JUMP TO LABEL loop_start
PRINT x

Actually, the processor version is even less readable. But this bulletin is just to give you an idea. If you want a good introduction to the Assembly language (the language of processors), have a look at the simple-English Wikipedia page.

The physics that makes computers compute

Even the processor instructions are not actually executed by the processor. At the lowest level, the processor modifies some electrical currents and this is how computation proceeds.

The processor modifies these currents with an electronic component known as a transistor: an electronic version of a switch. It either blocks current (at the input pin) or lets it through (to the output pin), depending on current (at the control pin). These transistors are used to create logic gates and these logic gates are used to create simple circuits.

But all that is a bit difficult to visualise. What does a transistor look like? How to arrange transistors into gates and gates into circuits?

Someone with these questions decided to build a computer that was big enough to look at: the megaprocessor!

This computer is big enough that you can just look at the components and see how they are assembled from transistors. There is a lot of information on the project official webpage, including images of different components.

If you live in Cambridge, or if you are visiting there, you can visit the Centre for Computing History where the megaprocessor is displayed (along with many other machines).


The evolution of computer hardware
Inside your computer (part 2)