First of all, what is a CPU? CPU (also commonly called a microprocessor) stands for “central processing unit”. It’s a very suitable name, because it describes exactly what the CPU does: it processes instructions that it gathers from decoding the code in programs and other such files. A CPU has four primary functions: fetch, decode, execute, and writeback.
Fetch
In the first step, the CPU retrieves the instruction that it needs to run from program memory. Each instruction in a program (which contains millions of instructions) is stored at a specific address. The CPU has a program counter, which keeps track of the CPU’s position in the program – more specifically, the address of the instruction that the CPU is accessing.