CPU Architecture
Central processing unit (CPU)
The primary component of a computer responsible for executing instructions and processing data. It performs arithmetic, logic, control, and input/output operations specified by the instructions in programs.
The central processing unit (CPU) is the brain of a computer, responsible for executing instructions and processing data. It consists of several key components, each with a specific role:
- Arithmetic Logic Unit (ALU): Performs arithmetic and logical operations.
- Control Unit (CU): Manages the execution of instructions by directing the flow of data within the CPU.
- Registers: Small, fast storage locations within the CPU, including the Memory Address Register (MAR) and Memory Data Register (MDR).
- Buses: CPU connections to primary memory and other components.
The CPU operates within the process phase of the input, process, output, and storage model, retrieving and saving data to and from primary memory.
A block diagram of the CPU illustrates the relationships between its components:

The Arithmetic Logic Unit (ALU)
Arithmetic Logic Unit (ALU)
A core digital circuit within the CPU that performs arithmetic and logical operations on binary data
The Arithmetic Logic Unit (ALU) is responsible for performing all arithmetic and logical operations. It is the computational engine of the CPU, handling tasks such as:
- Addition, subtraction, multiplication, and division
- Logical operations like AND, OR, and NOT
- Comparison operations such as greater than, less than, and equal to
When designing algorithms, consider how the ALU's operations can be optimized to reduce computational complexity.
The Control Unit (CU)
Control Unit
A key component of the CPU that manages and coordinates all operations within the computer
The Control Unit (CU) is the orchestrator of the CPU, responsible for:
- Fetching instructions from primary memory
- Decoding instructions to determine the required operations
- Executing instructions by coordinating the ALU and other components
The CU ensures that instructions are executed in the correct sequence, maintaining the flow of data within the CPU.
Registers: MAR and MDR
Registers
Registers are the fastest and smallest type of memory, built directly into the CPU.
They play a crucial role in the execution of instructions. Two important registers are:
- Memory Address Register (MAR):
- Holds the memory address of the data to be accessed.
- Communicates with primary memory via the Memory Address Bus.
- Memory Data Register (MDR):
- Holds the data to be transferred to or from memory.
- Communicates with primary memory via the Data Bus.
Don't confuse the MAR and MDR. The MAR holds addresses, while the MDR holds data.
ExampleImagine the MAR as a pointer to a specific location in memory, while the MDR acts as a container for the data being transferred.
Note- The CPU can only access data from primary memory (RAM).
- Any data stored on secondary storage (e.g., hard drives) must first be loaded into RAM.
Buses
Buses
Buses are communication pathways that transfer data between CPU components and other parts of the computer.