CPU, memory, input & output

The CPU of a computer handles all the input from various input devices such
as mice and keyboards and also the output, for the user to see the result
of his input.
Under the hood, the CPU executes billions of instructions per second,
according to its instruction cycle. The instruction cycle, also known as
the fetch-decode-execute cycle is what the CPU follows from boot-up to shutdown.
The cycle can be split in multiple stages. Even though cycle may differ for
different CPUs based on their instruction sets, it is similar to the following stages:

  1. Fetching: The next instruction is fetched from the memory address stored in the
    Program Counter and is stored in the Instruction Register. At the end of fetching,
    the Program Counter points to the next instruction.
  2. Decoding: The decoder interprets the instruction from the Instruction Register
  3. Executing: The Control Unit of the CPU passes the decoded information to the relevant
    function units of the CPU to perform the actions required by the instruction, such as reading values, performing arithmetic or logic functions on them and writing the result back to a register.
    The result is stored in memory or sent to an output device.
  4. Repeat

Receiving input from peripherals is done using interrupts. A CPU interrupt is a signal that causes some out-of-band processing to occur. When that happens, the CPU branches off to do some other function and, when it is finished, it returns to what it was doing right before the interrupt. That way, input can be processed right away by the CPU.

How computer compute using circuits

A standard computer is only capable of working with a binary system, which means it can only work with two states of information, that either being 1 or 0. In order to process the complexity of input information, the computer has to apply logic combining the set of two in order to produce the correct output.

This happens inside of a CPU thanks to tiny electronic components that form circuits. These circuits combine the binary input in simple logic gates that can generate specific binary output based on the nature of the input.

For example, the “not” circuit, reverts the input signal value, so if the input is 1, the output will be 0 and vice-versa. Another type of circuit, “and” only outputs 1 if both inputs are 1. These individual circuits perform simple logical calculations and are weak on their own, but combined together they can process more complex tasks.

The whole concept of computer’s computing power is to divide complex task into small primitive logical calculations that even a human could easily calculate. The advantage of computer is, that a single CPU has millions of these circuits and because electrons travel at almost the speed of light, one single CPU can calculate billions of these operations in a single second. 

Binary & Data

Computers work on ones and zeroes and it is a big part how they work on inside. If we would have a look inside the computer, we will find out that computer is compiled from electric wires and circuits and those are carrying all the information inside the computer. Information which is stored inside the computer is represented by bits. If computer has more wires it makes it able to store more bits, which is represented by more complex information.

Computer works on binary number system, what is defined only by zeroes and ones. Any number can be defined by binary number system, but not only numbers, it includes text, images and sounds as well.

For the text we can assign a number to each letter and this number can be defined in binary system. In case of images, videos or any other graphics, all of them are made of pixels and each pixel has colour which is represented in RGB system by numbers. Sound is defined as series of vibration which can be visualised in graph and any wave point of the graph can be defined as a number. Higher quality of the sound needs higher bit audio.

Everything in computer works on zeroes and ones and electrical signals and in circuits behind them. 

How does a computer work?

The meaning of computation according to definitions.net and wikipedia:
‘Computation is any type of calculation or use of computing technology in information processing. Computation is a process following a well-defined model understood and expressed as, for example, an algorithm, or a protocol.
…A computation can be seen as a purely physical phenomenon occurring inside a closed physical system called a computer. ‘

What is a computer?
A computer is a ‘thinking machine’ an information processor, we use it to manipulate information.

The computer has to perform 4 different tasks:
1. Take input: keyboard, mouse, microphone, camera, touchscreen
2. Store information: storing the information in the memory, for example: hard drive or memory card
3. Process it: a computer’s processor takes information for memory, it manipulates it or changes it using algorithm and then it sends the processed information back to be stored in memory again. This continues until the information is ready to be output.
4. Output the results: computer display, that can show videos/photos/text/interactive games/signals