How does a computer “understand” machine code?

The CPU knows nothing. A stream of high or low voltages is sent into the CPU every clock pulse, this passes through physical logic gates made of transistors. Which don't care about "data" or anything. It just does an output of electricity which is based off the input electricity it's given. This strings together simple mathematical sequences into a complex mathematical sequence, which creates a stream of electricity output. Which is then decided by more circuitry operating on similar principles to whatever e.g. data in a program. It's so mind boggingly complex, it takes a whole degree course to understand. I'm really really dumbing it down since you're not getting the answer from the other explanations. It all operates on very very simple logic made using electricity, and to understand the reasons why logic gates made of transistors work requires yet another explanation in electronics, physics and chemistry. Hope this helps a bit. Binary the way we see it is just a representation of the state of a transistor (on or off).

/r/computerscience Thread