An ALU (Arithmetic Logic Unit) is a core component of the CPU that performs arithmetic and logical operations on data.
What it does:
- Arithmetic operations: addition, subtraction, multiplication, division
- Logical operations: AND, OR, NOT, XOR
- Comparisons: greater than, less than, equal to
- Bit operations: shifts and rotates
In simple terms:
The ALU is the “calculator” of the CPU. Whenever a program needs to do math or make logical decisions, the ALU handles it.
Example:
If a program calculates 5 + 3, the ALU performs the addition and returns 8 to the CPU.
