Transcript
The first single-chip processors, in the early nineteen-seventies, ran about a hundred thousand instructions per second. A modern processor core runs billions. Faster clocks explain part of that. The rest comes from tricks. Today: three of the biggest. Guessing jumps, running instructions out of order, and using many cores.
Last time, a jump left the pipeline with instructions it had to throw away. So the processor guesses. A small table remembers what each jump did the last few times, and bets it will do the same again. Take our countdown loop. Each time around, the jump to the end is not taken, so the guess is: not taken. It's right every time until the very last, when the loop ends. Seven out of eight correct. Real loops run thousands of times, and real predictors are clever. They're right well over ninety percent of the time.
The second trick. Some instructions are slow. Loading from memory can take hundreds of ticks. The next instruction needs that value, so it has to wait. But the two after it don't need it at all. So the processor runs them first, while the load is still waiting. That's out-of-order execution. The results are still put back in the original order, so the program never notices. And a modern core can start several instructions on the same tick.
The third trick. Around two thousand five, clock speeds stopped climbing. Faster clocks meant too much heat. So chip makers put several complete processors, called cores, on one chip. Each core runs its own stream of instructions. Phones often have six or eight cores. Desktop chips often have eight, sixteen, or more. But more cores only help when the work can be split up. A program has to be written to share its work between them.
So: guess the jumps, run what's ready, and share the work between cores. But every one of these tricks stalls if data arrives slowly from memory. Next time: the small, fast memories that hide the wait. Caches. See you there.
Next episode: caches, the small, fast memories that hide the wait.