Computer basics in 3D

A standing 3D board shows a computer diagram with a CPU linked to input, output, RAM and storage blocks.Drag to turn

A computer is a machine that stores data and instructions as binary numbers and carries out the instructions to process the data. Laptops and desktops are common examples.

The main parts inside a laptop or desktop

A typical computer has a processor, memory, storage, input and output devices, and a main board that links them. The processor, or CPU, carries out instructions. Memory, called RAM, holds the programs and data in use right now, and it usually loses its contents when power is cut.

Storage, such as a solid-state drive, keeps files while the machine is off. Input devices such as a keyboard send data in. Output devices such as a screen show results.

The fetch, decode, execute cycle

The CPU repeats one cycle. It fetches an instruction from memory, decodes what it asks for, and executes it. A register called the program counter holds the address of the next instruction.

Each instruction is a small step, such as adding two numbers, copying a value, or jumping to another address. A clock sets the pace, and modern CPUs complete billions of cycles per second. The operating system is the program that shares the hardware among other programs and gives them access to files, memory and devices.

Worked example: adding 5 and 3 in binary

Computers use bits, each 0 or 1, because circuits can reliably tell two voltage levels apart. A group of n bits can hold 2^n values, so 8 bits hold 2^8 = 256 values. Text, images and instructions are stored as numbers using agreed encodings.

Here is 5 + 3 in four bits. 5 is 0101 and 3 is 0011. Working from the right, 1 + 1 = 10, so write 0 and carry 1. Next, 0 + 1 + 1 = 10, so write 0 and carry 1. Next, 1 + 0 + 1 = 10, so write 0 and carry 1. Last, 0 + 0 + 1 = 1. The result is 1000, which is 8, and 5 + 3 = 8. Circuits called logic gates perform this kind of addition in hardware.

Common misconceptions

Memory and storage are often confused. RAM is fast and temporary, while storage is slower and keeps data without power. A higher clock speed does not always mean a faster computer, because core count, memory speed and design also matter.

A CPU does not run Python or Java source text directly. A compiler or interpreter first turns the program into machine instructions, or into an intermediate form that is run by another program. A computer does not understand a task. It follows instructions exactly as given.

Where this design shows up

Phones, servers, game consoles and many embedded controllers share the same basic idea of a stored program run by a processor. This is often called the von Neumann architecture, though real machines add many refinements. Details such as the instruction set differ between devices.

Knowing this model explains everyday behaviour. A machine slows down when RAM fills up and the system must use storage instead. It also explains why code that touches less memory often runs faster.

Key terms

CPU
The processor, which fetches, decodes and executes instructions.
RAM
Fast, usually temporary memory that holds programs and data currently in use.
Storage
Slower memory, such as a solid-state drive, that keeps data without power.
Bit
A single binary digit, either 0 or 1.
Instruction
One small command a CPU can carry out, such as adding two numbers.
Operating system
The program that manages hardware and shares it among other programs.
Compiler
A program that translates source code into machine instructions.

Common questions

Why do computers use binary instead of decimal?

Electronic circuits can tell two states, such as high and low voltage, apart very reliably. Binary maps directly onto those states, and numbers and other data can be built from bits.

What is the difference between RAM and a hard drive or SSD?

RAM is fast and usually loses its contents when power is off. A hard drive or SSD is slower but keeps files without power. Programs are loaded from storage into RAM to run.

What does the operating system do?

It manages the hardware and shares the CPU, memory and devices among running programs. It also provides files and a way for programs to talk to hardware.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.