CPUs
How a processor works: cores and threads, clock speed and cache, x86 versus ARM, sockets, and keeping it cool.
What a CPU does
The central processing unit (CPU), or processor, is the chip that executes the instructions of programs. Everything a computer does, from moving the mouse pointer to recalculating a spreadsheet, ends up as a long list of very simple instructions: add two numbers, compare two values, copy data from memory, jump to another instruction. These instructions are machine code; the CPU runs them one after another, very fast.
Inside, three parts do the work:
- The control unit reads instructions and directs the other parts.
- The arithmetic logic unit (ALU) does calculations and comparisons.
- Registers are a small number of storage places inside the CPU for the values it is working on. One special register, the program counter, holds the memory address of the next instruction.
The fetch–decode–execute cycle
- Fetch: read the instruction at the address in the program counter from memory (in practice, from the cache).
- Decode: work out what the instruction means and which data it needs.
- Execute: carry it out, for example let the ALU add two registers, or load a value from memory. The result is written to a register or to memory.
Then the program counter moves on, normally to the next instruction, or to another address when the instruction was a jump. A modern CPU works on dozens of instructions at once in a pipeline, executes several per cycle, and even guesses which way a branch will go. It still produces the same result as this simple cycle.
Cores and threads
A core is a complete processing unit inside a CPU, with its own control unit, ALUs, registers and first levels of cache. A CPU with eight cores can execute eight streams of instructions truly at the same time. Until the mid-2000s a desktop CPU had one core; when clock speeds stopped rising because of heat, manufacturers put more cores on each chip instead.
More cores only help when there is parallel work. Video encoding, compiling code and running virtual machines use every core; many everyday programs mainly use one or two, and profit more from a faster core than from more of them. The operating system schedules threads, the units of execution of programs, onto the available cores.
Simultaneous multithreading
Simultaneous multithreading (SMT) lets one physical core run two threads at once, by giving it two sets of registers that share the core's execution units. Intel calls it Hyper-Threading. When one thread waits, for example for data from memory, the other can use the execution units that would otherwise sit idle. The gain depends on the workload and is much less than a second core would give; for some tasks it is close to nothing.
The operating system sees each hardware thread as a logical processor. A CPU with 6 cores and SMT shows 12 logical processors in Task Manager. Some recent designs leave SMT out, trading it for simpler, more efficient cores.
Hybrid designs
Many current CPUs combine two kinds of cores: large performance cores for demanding work and small efficiency cores for background tasks at low power. ARM chips in phones did this first; Intel calls them P-cores and E-cores. That is why a spec sheet can say "10 cores, 12 threads": 2 performance cores with SMT (4 threads) plus 8 efficiency cores without (8 threads).
Checking a real CPU
On Windows, Task Manager's Performance tab shows the CPU name, base
speed, cores, logical processors, cache sizes and whether
virtualization is enabled. On Linux, lscpu shows the
same. Shortened, illustrative output for a 6-core desktop CPU:
lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 12
On-line CPU(s) list: 0-11
Vendor ID: AuthenticAMD
Model name: AMD Ryzen 5 7600 6-Core Processor
Thread(s) per core: 2
Core(s) per socket: 6
Socket(s): 1
CPU max MHz: 5100.0000
Virtualization features:
Virtualization: AMD-V
Caches (sum of all):
L1d: 192 KiB (6 instances)
L1i: 192 KiB (6 instances)
L2: 6 MiB (6 instances)
L3: 32 MiB (1 instance)
-
CPU(s): 12withThread(s) per core: 2andCore(s) per socket: 6: six cores with SMT, twelve logical processors. -
CPU op-mode(s): 32-bit, 64-bit: an x86-64 CPU that can also run 32-bit code. -
Caches: per-core L1 (split in data and instructions) and L2, and one shared L3. See cache below.
Clock speed
A CPU works in steps timed by a clock signal. The clock speed is the number of clock cycles per second, given in gigahertz (GHz): 1 GHz is one billion cycles per second. Each step of the work takes at least one cycle, so a higher clock means more steps per second for the same design.
- The base clock is the speed the manufacturer guarantees under a sustained full load within its power and cooling specification.
- The boost clock (Intel Turbo Boost, AMD Precision Boost) is the highest speed a core can reach when there is power and thermal headroom. It is typically reached on one or a few cores, for short periods.
The CPU changes its clock continuously, from a few hundred MHz when idle to its boost clock under load, to save power. So a low number in a monitoring tool on an idle machine is normal. A low clock under full load is not: that usually means the CPU is too hot or the laptop is on a power-saving plan.
Why GHz alone does not compare CPUs
How much a CPU gets done depends on how many instructions it completes per clock cycle, its instructions per cycle (IPC), as much as on the clock itself. IPC differs between designs and grows with every generation, through wider cores, better branch prediction and larger caches. The example shows what the clock numbers mean, and why a slower clock can win:
for ghz in (1.0, 2.5, 5.0):
cycles = ghz * 10**9 # clock cycles per second
print(f"{ghz} GHz: {cycles:,.0f} cycles per second, one cycle = {1 / ghz:.1f} ns")
# Hypothetical IPC values: instructions completed per clock cycle.
for name, ghz, ipc in [("CPU A", 5.0, 2), ("CPU B", 3.5, 4)]:
billions = ghz * ipc
print(f"{name}: {ghz} GHz x IPC {ipc} = {billions:.0f} billion instructions per second")
1.0 GHz: 1,000,000,000 cycles per second, one cycle = 1.0 ns 2.5 GHz: 2,500,000,000 cycles per second, one cycle = 0.4 ns 5.0 GHz: 5,000,000,000 cycles per second, one cycle = 0.2 ns CPU A: 5.0 GHz x IPC 2 = 10 billion instructions per second CPU B: 3.5 GHz x IPC 4 = 14 billion instructions per second
The IPC values are invented to show the principle; real IPC is not printed on any spec sheet and depends on the program. Two practical conclusions follow. First, "cores × GHz" is not a measure of performance, because it ignores IPC, cache and memory. Second, to compare two CPUs, use benchmarks of the kind of work the user does, and compare within one generation when you can.
Cache
RAM is fast compared with a drive, but slow compared with a CPU: a core can run hundreds of cycles in the time one read from RAM takes. A CPU cache is a small, very fast memory built into the processor that keeps copies of recently used data and instructions, so most reads never have to wait for RAM. It works because programs tend to reuse the same data and to read data that lies close together.
- L1 (level 1): the smallest and fastest, per core, split into an instruction cache and a data cache.
- L2: larger and a little slower; usually per core.
- L3: the largest and slowest cache, shared by all cores (or by a group of cores). It is the "cache" figure on most spec sheets.
Cache is built from static RAM (SRAM), which is fast but takes much more chip area per bit than the dynamic RAM (DRAM) of memory modules, which is why it is measured in megabytes, not gigabytes. A larger L3 cache helps workloads that repeatedly use more data than fits in L2, such as many games and databases. Main memory is covered in Memory.
Instruction set architectures
An instruction set architecture (ISA) is the set of machine instructions a CPU understands. Programs are compiled for one ISA, and a CPU of another ISA cannot run them directly. Two families dominate.
32-bit and 64-bit
The "bits" of a CPU are the width of its general-purpose registers and, with that, of the memory addresses it can easily work with. A 32-bit address can point to 232 different bytes, which is exactly 4 GiB. That is why a 32-bit operating system cannot use much more than 4 GB of RAM, however much is installed.
units = ["bytes", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB"]
def binary_size(n):
"""Express n bytes in the largest binary unit that gives a whole number."""
i = 0
while n % 1024 == 0 and i < len(units) - 1:
n //= 1024
i += 1
return f"{n} {units[i]}"
for bits in (32, 48, 64):
print(f"{bits}-bit addresses: {binary_size(2**bits)}")
32-bit addresses: 4 GiB 48-bit addresses: 256 TiB 64-bit addresses: 16 EiB
A 64-bit CPU could in theory address 16 EiB. Current CPUs use fewer address bits in practice, commonly 48 for virtual addresses, which is still far beyond any installed memory. A 64-bit operating system can run most 32-bit programs, but not the other way round, and 64-bit drivers are required. Windows 11 exists only as a 64-bit version.
x86-64
x86-64 is the 64-bit instruction set of Intel and AMD processors, an extension of Intel's older 32-bit x86 instruction set. AMD designed the 64-bit extension (as AMD64), and Intel adopted it; that is why you meet the same thing under the names x64, amd64 and Intel 64. It is the architecture of almost all desktop PCs, most laptops and most servers. x86 is traditionally called a complex instruction set computer (CISC) design: it has many instructions, some of which do a lot of work each.
ARM
ARM is a family of instruction sets designed by Arm, which licenses them to other companies that build their own chips. It is a reduced instruction set computer (RISC) design: fewer, simpler instructions, which makes efficient, low-power chips easier to build. ARM runs almost every phone and tablet, Apple's Mac computers since the switch to Apple silicon in 2020, Windows laptops with Qualcomm Snapdragon processors, many embedded devices, and a growing share of cloud servers. The 64-bit version is called ARM64 or AArch64.
For a technician, the difference shows up in software. An app built for x86-64 does not run natively on an ARM laptop. Both macOS and Windows on ARM translate most such apps automatically, at some cost in speed; but drivers cannot be translated. Hardware that needs a driver (a printer, a virtual private network (VPN) client, some security software) must have a native ARM64 version.
Built-in features
Integrated graphics
Many CPUs contain a graphics processor on the same chip or package, which uses part of the system RAM as video memory. It is enough for office work, video and light games, and the video ports on the motherboard's rear panel only work with it. Not every CPU has one: Intel desktop models with an F at the end of their name, for example, have none, and need a graphics card. Check the spec sheet. See Expansion Cards and Graphics.
Virtualization support
Hardware virtualization extensions, Intel VT-x and AMD-V (AMD calls it SVM in firmware), let one computer run virtual machines efficiently; they are often disabled in the firmware by default and must be switched on there. Virtualization itself is covered in the Cloud topic.
Power, heat and cooling
Almost all the electrical power a CPU uses turns into heat, in a chip the size of a fingernail. Without cooling, a modern CPU would reach its temperature limit within seconds. Before that limit it protects itself: it lowers its clock (thermal throttling), and if that is not enough, the system shuts down.
TDP
Thermal design power (TDP) is the amount of heat, in watts, that a cooler must be able to remove for the CPU to run at its base clock under a sustained heavy load. Typical values are about 15–28 W for thin laptops and 65–125 W for desktops. TDP is a cooling target, not the maximum power draw: while boosting, a CPU can draw well above it for a while. Intel now publishes a "Processor Base Power" and a "Maximum Turbo Power", and AMD a separate package power limit, which are more useful for sizing a cooler and power supply.
Heat sinks and fans
A heat sink is a block of metal, usually aluminum or copper, with many thin fins. It conducts heat away from the component it sits on and gives it a large surface to pass on to the air. Copper heat pipes inside move heat quickly from the base to the fins. A fan blows air through the fins; without airflow a heat sink soon saturates. Case fans then move the warm air out: typically in at the front and bottom, out at the back and top.
- Air cooling: a heat sink with one or two fans on the CPU. Simple, reliable and cheap.
- Liquid cooling: a pump block on the CPU moves liquid through tubes to a radiator with fans. All-in-one (AIO) coolers are sealed units. A failing pump gives the same symptoms as no cooler at all.
- Passive cooling: a heat sink without a fan, for low-power devices such as phones, tablets and fanless mini PCs.
Thermal paste
Thermal paste (thermal compound) is a heat-conducting paste applied in a thin layer between a CPU and its cooler. It fills the microscopic unevenness in both surfaces, which would otherwise hold air, and air conducts heat very poorly. Only a small amount is needed; the cooler's pressure spreads it. Laptops and graphics cards often use thermal pads for other chips.
Installing a CPU safely
A CPU and its socket are among the most delicate parts of a computer. Before you start, check the board's CPU support list and update the firmware first if the new CPU needs it. Then:
- Power off, unplug the power cord, and ground yourself with an antistatic wrist strap; see Safety and Handling.
- Open the socket: lift the retention lever and, on an LGA socket, the load plate. Hold the CPU by its edges and never touch the contacts or the socket pins.
- Align the CPU: a small triangle on one corner of the CPU matches a mark on the socket, and notches in the edge match the socket keys.
- Lower it straight into place. It needs no force at all; if it does not drop in, it is misaligned. Close the lever. On many Intel boards the plastic socket cover pops off now: keep it, in case the board ever has to be returned.
- Clean off any old paste with isopropyl alcohol, apply a small amount of new thermal paste, and mount the cooler with even pressure, tightening screws a little at a time in a diagonal order.
- Connect the cooler's fan (or pump) to the CPU_FAN header, then check the CPU temperature in the firmware setup before installing anything else.