Central Processing Unit (CPU)
The CPU is the electronic circuitry that executes instructions comprising a computer program.
From CS241E, a CPU is composed of:
- Control Unit
- ALU (“Processing Unit”)
- Registers (to store bits)
The processor logically comprises of 2 main components:
- Datapath
- Control
We can model a simple Computer from the following diagram.
- Memory: We can store words. To access these words, we make use of addresses
- Every valid address starts with 8 zero bits,
- followed by 22 bits that identify one of the words in memory,
- followed by 2 more zero bits.
- So the address is a multiple of between and inclusive.
- This is convention: Early CPUs has words of bits numbered sequentially; since one of our words is four times as wide, our addresses count by fours.
On the left is the CPU:
- The CPU also contains a smaller amount of memory called registers, in our case 34 registers of 32 bits each.
- CPU contains an ALU and Control Unit
So how do CPUs get faster over the years?
See this article and this Quora. They make CPUs more efficient by increasing IPC, i.e. the number of instructions per clock cycle. Essentially, make the transistors smaller so you can fix more ALUs, and thus do more operations.
CPU Core
What makes up a CPU core?
- ALU (Arithmetic Logic Unit): Performs arithmetic and logic operations.
- Control Unit: Manages the execution of instructions.
- Registers: Small, fast storage locations for temporary data.
- Cache Memory: High-speed memory close to the core for quick data access.
- Instruction Decoder: Translates machine code into executable operations.
- Bus Interface: Handles communication between the core and other components.
- Pipeline Stages: Breaks down instruction processing into smaller tasks for efficienc
in the early days of computing, a CPU was only consisted of a single core. However, modern CPUs have multiple cores to handle tasks in parallel, improving performance and efficiency.
On Multi-Core CPUs
Multi-core CPUs are not just about “doubling” the power of a single core. They also introduce complexities in terms of how tasks are divided among cores, how data is shared or synchronized between them, and how to efficiently utilize them. Operating systems and software have also evolved to take advantage of multi-core architectures through techniques like thread-level parallelism and task scheduling.
CPUs vs. GPUs
Learned from Hemal Shah.
See NVIDIA where I talk about the vision.
CPUs are designed for single-threaded operations whereas GPUs are designed for massive parallel processing.
CPU vs. GPU:
- CPUs are very good at executing instructions very fast, whereas GPUs are rather slow at executing a single instruction. However, they can execute thousands of instructions at the same time