Computer Architecture and the CPU
Inside the machine
The fetch-decode-execute cycle
A CPU repeatedly fetches an instruction from memory, decodes it, executes it, and stores the result. This cycle happens billions of times and is the foundation of program execution. Performance depends on how fast instructions and data can move through the system.
Important hardware concepts
Why caches matter
Programs are often limited by memory access speed, not just raw CPU speed. Caches reduce the average time needed to access data.
What does the CPU fetch-decode-execute cycle describe?
It is the core loop of instruction execution.
Correct answer: How the CPU processes instructions repeatedly
Why can a faster CPU still be slowed down by memory?
Memory latency can bottleneck execution.
Correct answer: Because waiting for data from RAM is much slower than reading from registers or cache.
Parallelism and pipelines
Modern processors use pipelining, multiple cores, and sometimes vector instructions to increase throughput. These techniques allow several operations to be in progress at once, though dependencies and branch mispredictions can reduce the benefit.
Which memory is typically fastest?
Cache is much closer to the CPU and is faster than RAM and storage.
Correct answer: Cache
What is one reason instruction sets matter to programmers?
Architecture influences performance and compatibility.
Correct answer: They determine which low-level operations a CPU can perform efficiently.