Central Processing Unit
The central processing unit, or CPU, is the part of a computer that runs programs: it repeatedly fetches an instruction from memory, works out what that instruction asks for, carries it out, and moves on to the next, billions of times a second. Everything a computer appears to do, from showing a web page to training a neural network's control loop, is reduced by compilers and operating systems to long sequences of very simple machine instructions such as load a number, add two numbers, compare, or jump somewhere else, and the CPU is the component that executes them. In a modern machine the CPU is a single integrated circuit, often with several cores, but the idea dates to the stored-program designs of the 1940s.
The defining idea is the fetch-decode-execute cycle, which is possible because instructions are stored in memory as ordinary numbers. This stored-program concept, set out in John von Neumann's 1945 First Draft of a Report on the EDVAC and put to work in machines such as the Manchester Baby in 1948 and EDSAC in 1949, means a program can be loaded, replaced or even modified like any other data. A register called the program counter holds the address of the next instruction; the CPU fetches the instruction at that address into an instruction register, decodes its fields to see the operation and operands, executes it, and then updates the program counter, either by advancing to the next instruction or, for a jump or branch, by loading a new address. The cycle never stops while the machine is powered.
A CPU is a small set of cooperating parts, each with a narrow job. Registers are the fastest storage, a few dozen word-sized slots that hold operands and results; the arithmetic logic unit performs the calculation; the control unit sequences the steps and issues the signals; and caches hold recently used memory close by so the processor does not wait for much slower main memory. A memory interface connects it to RAM, and on-chip units handle floating-point and vector arithmetic, memory translation, and interrupts. The instruction set architecture, such as x86 (begun with the Intel 8086 in 1978), Arm or RISC-V, is the published contract of operations and registers that programs are compiled against, and it is separate from the design underneath.
Real CPUs do not execute one instruction at a time but overlap them aggressively, and that has consequences. Pipelining splits the cycle into stages so that several instructions are in flight at once; superscalar designs issue several per clock; out-of-order engines reorder work to avoid waiting; and branch predictors guess which way a conditional jump will go so the pipeline keeps full. The Intel 4004 of 1971 handled four-bit data at under a megahertz, whereas a modern core can retire several instructions every cycle at several gigahertz. Speculation brought a security cost: the Spectre and Meltdown flaws disclosed in January 2018 showed that data touched speculatively could be inferred through timing side effects, and software and hardware mitigations followed.
Practical points follow from this structure. A CPU executes machine code, not Python or Java, so high-level programs reach it through compilers or interpreters; the operating system lets many programs share it by switching among them rapidly and by using interrupts and privilege levels to keep programs from interfering with each other. A single CPU core does one stream of instructions at a time, so speed on multi-core chips depends on parallel software. For machine learning, CPUs handle data loading, preprocessing and orchestration, while GPUs and similar accelerators perform most of the training arithmetic. Typical misconceptions are that "CPU" means the whole computer box (it is one chip within it), that clock speed alone sets performance, and that the CPU stores programs or files, which belong to memory and storage.
Read the CPU as a tireless clerk working from a numbered list: look at the line the pointer marks, do what it says, move the pointer, and repeat, so quickly and so many times that the list becomes software.