Processor
Components
- execution units
- arithmetic logic unit (ALU) for integer and logical operations
- floating point unit (FPU) for floating-point arithmetic
- graphics processing unit (GPU) for specialized 3-D graphics calculations
- others for special functions like AI, cryptography
- control units
- load, decode, execute, store
- may be pipelined, where execution of instructions overlaps
- may be speculative, where instructions after a branch are executed before they're needed
- registers
- many for local storage of data, addresses, instructions
- program counter for address of next instruction
- stack pointer for top-of-stack address
- status register for flags which indicate processor state
- cache
- local fast storage for instructions and data
- layered from smaller and faster L1 to bigger and slower L2 and L3
- multiple cores
- a CPU can contain from 1 to 256 or more cores
- cores can simultaneously execute separate streams of instructions
- cores generally have separate L1 cache but may share L2 and L3 cache
- cores share all other resources such as main memory, I/O, and power
- cores may be identical or may be optimized for different characteristics
- clock multiplier
- multiplies external clock for different parts of the CPU
- internal clock frequencies are too high to transmit outside of the CPU
- interrupt controller
- allows external events to suspend execution and start another program
- interrupt vector table contains addresses of programs to service each interrupt
- memory management unit (MMU)
- maps pages of virtual memory to page frames of physical memory
- page table contains a list of the mappings
- translation lookaside buffer (TLB) caches recently used page table entries
- I/O memory management unit (IOMMU) does the same for the I/O address space
- power management
- controls voltages and clock speeds
- maximizes performance without excess power dissipation
- low-power states are provided for idle, standby, sleep, hibernation, etc.
- Intel Intel Management Engine
- contains its own CPU (ARM), RAM, firmware (unsupported use of Minix3)
- runs whenever power is applied
- has access to other components
- AMD Secure Technology or AMD Platform Security Processor
- contains its own CPU (ARM), RAM, firmware
- runs whenever power is applied
- has access to other components
Instruction Sets
- reduced instruction set computer (RISC)
- limited to simple instructions which are most frequently executed
- those simple instructions are optimized for efficiency
- examples: ARM, MIPS, RISC-V
- complex instruction set computer (CISC)
- implements many more instructions
- complex instructions perform operations which would require many simple instructions
- complex instructions might be implemented in microcode (programs within the CPU)
- examples: Intel X86
Modes
- kernel mode
- CPU can execute any instructions and access any resources
- used by operating system kernel
- user mode
- hardware terminates user programs attempting to run privileged instructions
- hardware terminates user programs attempting to access unallocated resources
- used by unprivileged user processes
- other modes
- some CPUs implement more than 2 modes or rings in a hierarchy
- additional modes allow separate protection for virtual machine hypervisors, etc.
Word Size
- registers, memory bus, and I/O bus usually use the same word size
- 8 bits in small microcontrollers
- 16 bits in medium microcontrollers
- 32 bits in large microcontrollers, some mobile SOCs
- 64 bits in some mobile SOCs and most laptop/desktop/server CPUs
- larger registers (up to 512 bits) can be used for some instructions
Physical Characteristics
- voltages
- around 1 V
- often variable, higher to increase speed, lower to reduce power
- frequencies
- up to 5+ GHz
- often variable, higher to increase speed, lower to reduce power
- power
- TDP is maximum power which can be dissipated through the package
- in normal operation CPUs usually dissipate less than TDP
- embedded CPUs down to μW
- phone SoCs (system on chip) typically 3 to 20 W
- laptop CPUs typically 10 to 80 W
- desktop CPUs typically 45 to 280 W
- general purpose server/workstation CPUs up to 500 W
UNIX considerations
- architecture
- x86_64 (Intel, AMD) almost universally supported
- x86 (Intel, AMD 32 bit) widely supported
- ARM (32 and 64 bit) widely supported
- others occasionally supported
- word size
- 64 bit almost universally supported
- 32 bit widely supported
- other
- protected mode almost universally required
- virtual memory almost universally required
- virtualization hardware (AMD-V, VT-x) usually required for running VMs