Central Processing Unit (CPU)

The CPU is the electronic circuitry that executes instructions comprising a computer program.

From CS241E, a CPU is composed of:

The processor logically comprises of 2 main components:

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?

  1. ALU (Arithmetic Logic Unit): Performs arithmetic and logic operations.
  2. Control Unit: Manages the execution of instructions.
  3. Registers: Small, fast storage locations for temporary data.
  4. Cache Memory: High-speed memory close to the core for quick data access.
  5. Instruction Decoder: Translates machine code into executable operations.
  6. Bus Interface: Handles communication between the core and other components.
  7. 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