ALU: The Heart of Computing
The Arithmetic Logic Unit (ALU) is the brain of the processor, its mathematical center. From the outside, the ALU looks like a complex black box that can add, subtract, compare, and shift bits.
But inside, there is absolutely no magic. In parallel, you simply have an adder and a block of logic gates (AND, OR, XOR). When two numbers enter the ALU, it performs all available operations on them simultaneously!
So how do you get a single correct answer? Very simple. At the output of all these computational blocks sits a large multiplexer. Having received the operation code from the processor (for example, the "Add" instruction), this multiplexer simply selects the right wire with the already-computed sum result, forwards it to the output, and ignores all the other results.
Practical example. When the processor executes an ADD 5 instruction, inside the ALU the following happens: both operands simultaneously go to the adder (which computes A+B), the AND block (A&B), the OR block (A|B), and the shift block. All four results are computed instantly, in parallel. The instruction decoder sends code 00 ("addition") to the multiplexer, and it selects the adder's output. The other three results are simply discarded. Parallelism is the key to speed.