Modern computers – The computers at our desks

As you may have heard, the computers we have on our desks or in our pockets (like smartphones) work with only two distinct states, that we call 0 and 1. We also speak of bits. Computers use electrical signals for this purpose: If the voltage is low, this is interpreted as 0. If the voltage is high, it is interpreted as 1. In principle, however, the logic described by this system can be represented by anything that has two states: in the case of coins by heads (0) / tails (1) or in the case of a light switch by light off (0) / light on (1).

Gates

A bit is the smallest unit of information in a conventional computer. Any piece of information, be it a picture, a video or a text can be represented by (a probably very long) sequence of bits. The power of a computer stems from its ability to manipulate these bits.

Let’s take a look at how this is achieved. Therefore, think of a light bulb, which can also represent a bit. If electricity flows, the light bulb burns; if no electricity flows, it stays off.

!
Flip the light switch to see what happens!

For computers to produce useful results and run programs, they need a way to process and manipulate these bits. For this purpose, computers have so-called gates. A gate has one or more inputs at which it receives signals and one or more outputs at which it passes on signals. Gates are often represented using squares or rectangles. How a gate works can be illustrated with a NOT gate and a light switch.

!
Flip the light switch once again to see what happens!
What best describes the effect of the NOT gate?

Circuits, because a single gate isn’t that useful

Several gates together form a circuit and are thus the basis for computers as we know them. An algorithm that can be executed by a computer is then nothing more than a precise description of when to apply which gate. Bits are manipulated over time in a stepwise fashion. To understand how a conventional computer works at its core, it is helpful to understand how these gates work.

Circuits can be represented in diagrams much like musical notes. A musician begins on the left at time zero and progresses in time by reading to the right.

Similarly, circuits represent gate operations as a series of moments in time. Like music sheets, the diagram is to be read from left to right. This circuit here is 3 moments long and uses 2 bits (thanks to Stewart Smith for this analogy images):

Bit 1 Bit 2

Circuit diagrams

Reading from left to right, we can observe what happens at each moment. We start in the first column with both bits being initialized with a value 0. In column 1, a gate is applied only to the first bit. Nothing happens with the second bit. The gate in the second step processes bit 1 and 2 together and delivers two outputs. In the third step, a gate is applied to each of the two bits separately.

NOT-Gate

Let’s take a closer look at three different gates.

!
A well-known gate is the NOT gate. Execute the circuit by hitting Measure. Change the inputs 0 and 1 by clicking on the number at the beginning of the line.

0 1 2 Nr. 1 3 4 NOT

One way to get an idea of how gates work is to use truth tables. A truth table describes how a gate behaves for every input. For this purpose, one typically writes down the corresponding output for each possible input combination.

Since it accepts only one bit as input, the truth table of the NOT gate consists of only two lines:

Input Output
0 1
1 0

If the input is 0, the output becomes 1 and vice versa.

≥1 gate

!
Find out about the ≥1 gate by trying different input values and making several measurements!
Notes
0 0 1 2 Nr. 1 Nr. 2 3 4 ≥1
My measurements
What best describes the effect of the ≥1 gate?

? gate

!
Find out about the ? gate by trying different input values and making multiple measurements!
Notes
0 0 1 2 Nr. 1 Nr. 2 3 4 ?
My measurements
What best describes the effect of the ? gate?