The full picture
🎬 How a CPU runs your code: fetch → decode → execute
1 / 5A program is just bytes in memory. The program counter (PC) holds the address of the next instruction: here 0x1000, an ADD. The CPU loops forever: fetch → decode → execute.
- Registers are the top of the memory hierarchy: a few dozen named slots (~0.3ns) — the compiler's register allocator decides which of your variables live there; 'spilling' to stack is a real performance event.
- Control flow is just PC arithmetic: a branch writes the PC; a call pushes a return address and jumps; a return pops it — which is why the call stack, stack overflows and ROP attacks all make mechanical sense.
- Java bridge: bytecode is not this — the JVM interprets it, then the JIT compiles hot paths to exactly these machine instructions. 'What does the machine run?' has a two-layer answer on the JVM, and interviewers enjoy hearing you keep the layers straight.
- Von Neumann's essence: instructions and data share one memory — a program can be data (JIT output is data becoming code; W^X pages exist to control precisely that).