M1-R5.1 · Unit 1 · Introduction to Computer

Central Processing Unit

The brain of every computer — understand how the CPU's Control Unit, ALU, and registers work together to execute every instruction.

1. What is the Central Processing Unit (CPU)?

The Central Processing Unit (CPU) is the primary component of a computer that acts as its "brain." It contains advanced electronic circuitry designed to execute the instructions of a software program by performing essential arithmetic, logical, control, and input/output (I/O) operations.

Physically, the CPU is a silicon microchip placed securely into a dedicated socket on the motherboard. Without a CPU, a computer cannot function or process any information.

Modern CPU Brands: Popular examples include Intel (Core i3, i5, i7, i9), AMD (Ryzen series), Apple (M-series silicon like M1, M2), and Snapdragon/MediaTek processors primarily used in mobile devices.

2. Core Components of the CPU

The internal architecture of a standard CPU is primarily divided into three functional units that coordinate closely to process information seamlessly.

A) Control Unit (CU)

The Control Unit acts like a traffic manager or orchestra conductor. It does not process data itself; rather, it directs and coordinates all operations happening inside the CPU.

  • Fetches instructions from the main memory (RAM).
  • Decodes instructions to understand what action is required.
  • Sends electrical signals to the ALU, memory, and I/O devices to instruct them on how to respond.
B) Arithmetic Logic Unit (ALU)

The ALU is the true mathematical powerhouse of the CPU. It handles all mathematical calculations and logical decision-making processes.

  • Arithmetic Operations: Addition (+), Subtraction (-), Multiplication (*), and Division (/).
  • Logical Operations: Comparisons such as greater than (>), less than (<), equal to (==), not equal (!=), AND, OR, NOT.
  • Results are temporarily sent to a specific register (called the Accumulator) before being written to memory.
C) Registers

Registers are ultra-fast, tiny storage locations physically built into the CPU itself. They temporarily hold instructions, data, and memory addresses while the CPU works on them.

  • Program Counter (PC): Holds the exact memory address of the next instruction to be fetched and executed.
  • Instruction Register (IR): Holds the current instruction that the Control Unit is decoding and executing right now.
  • Accumulator (AC): Holds the intermediate and final arithmetic/logic results generated by the ALU.
  • Memory Address Register (MAR): Stores the memory address of data that needs to be fetched or stored.
  • Memory Buffer Register (MBR): Holds the actual data that has been fetched from or is about to be stored in memory.

3. The Fetch-Decode-Execute Cycle

The CPU processes instructions constantly through a repetitive sequence called the Machine Cycle or the Instruction Cycle. Every single action a computer performs boils down to this four-step loop, repeating billions of times every second.

Step Action Performed
1. FETCH The Control Unit retrieves the next instruction from RAM, using the address stored in the Program Counter (PC). The PC is then incremented to point to the following instruction.
2. DECODE The Control Unit translates (decodes) the instruction into a series of fundamental control signals, determining exactly what needs to be done.
3. EXECUTE The appropriate CPU component (usually the ALU) carries out the actual command—such as performing a calculation or making a logical comparison.
4. STORE The result of the execution is written back to a CPU register (like the Accumulator) or sent directly into the main memory (RAM).

4. CPU Speed and Performance Factors

Not all CPUs are created equal. Several critical hardware specifications determine how quickly and efficiently a processor can perform tasks.

Clock Speed
Measured in Gigahertz (GHz). It represents the number of machine cycles a CPU can perform per second (1 GHz = 1 billion cycles/sec).
Number of Cores
More cores mean the CPU can multitask hardware-level instructions simultaneously (e.g., Quad-core, Octa-core).
Word Size
The amount of data a CPU can process at once (commonly 32-bit or 64-bit). 64-bit CPUs handle vastly larger memory addresses.
Bus Width
The size of the physical electrical pathways determining how much data can move between the CPU and RAM concurrently.

5. Understanding Cache Memory

Because RAM is physically further away and slower than the CPU, waiting for data from RAM bottlenecks the processor. To fix this, CPUs feature Cache Memory—incredibly fast SRAM integrated directly into or near the CPU die to store frequently accessed data.

  • L1 (Level 1) Cache: The absolute fastest cache, physically embedded inside each CPU core. It is the smallest in capacity (usually 32 KB to 512 KB).
  • L2 (Level 2) Cache: Slightly slower than L1 but larger (256 KB to 4 MB). Can be dedicated per core or shared among a couple of cores.
  • L3 (Level 3) Cache: Slower than L1/L2 but much larger (4 MB to 64 MB or more). This cache is generally shared across all cores on the CPU chip.

6. Multi-core Processors & Hyper-Threading

In the past, single-core processors could only execute one task at a single moment. Modern CPUs feature multi-core technology, embedding multiple independent processing units (cores) into one single physical chip.

Dual-Core 2 Cores. Capable of handling two distinct tasks at the exact same time. Common in budget PCs.
Quad-Core 4 Cores. The standard for most modern everyday laptops and desktop computers.
Hexa/Octa-Core 6 or 8 Cores. Excellent for heavy gaming, video editing, and flagship smartphones.
Hyper-Threading: An Intel technology that allows a single physical core to act as two logical (virtual) cores. For example, a 4-core processor with hyper-threading behaves like an 8-core processor, improving multitasking efficiency.

7. CPU vs. GPU (Graphics Processing Unit)

While the CPU is the general-purpose brain, the GPU is a specialized circuit designed originally for rendering images and video.

  • CPU: Features a few (e.g., 4 to 16) highly powerful cores optimized for sequential processing. It excels at jumping between varied, complex tasks quickly.
  • GPU: Features thousands of smaller, simpler cores optimized for parallel processing. It excels at doing simple mathematical operations on massive datasets simultaneously (vital for 3D graphics, video rendering, and Artificial Intelligence).

8. Comparison: CU vs ALU vs Registers

Feature Control Unit (CU) Arithmetic Logic Unit (ALU) Registers
Primary Role Directs and coordinates system operations. Performs math and logic operations. Temporarily holds data, addresses, and instructions.
Processes Data? No Yes No (merely stores it)
Analogy Traffic Cop / Orchestra Conductor Calculator / Mathematician Whiteboard / Sticky Notes