Understanding Processors
But what does all that mean? How do processors work? That’s what we’re going to attempt to cover in brief here.
Now, before we get into AMD’s answer to Intel’s Hyper-Threading, we need to understand exactly how calculations and data are processed via the CPU. Generally speaking, software asks a series of complex questions, one at a time, (known as the program order), which traditionally the processor then calculates, one after the other in serial. However, because processors calculate problems far faster than they can draw data from DDR, SSDs, or hard drives, this can lead to delays, as data strings may not always be located on the processor’s cache, but somewhere else in the system.
Traditionally, it would go something like this: Calculation A provides answer B, which is used in calculation C, with data D drawn from DRAM, after which calculation E occurs. However, because we’re waiting on data D, we’re essentially stalling the unit, by not utilizing those execution units at 100-percent load.
Out-of-order execution (OoOE) looks to rectify this by determining which instructions require data that’s stored in memory, establishing how long it will take to retrieve said data, then reordering the instructions so that instead of running in the original program order, it runs dependent on the availability of data. So, in our
scenario, it would go like this: Calculation E is first, followed by calculation A, followed by calculation C, and by the time calculation C begins, hopefully enough clock cycles have passed for the processor to draw that absent data into the registers from the DRAM. The calculations that have been processed prior to the arrival of data D are held in what’s known as a retire queue, and once the final calculation has been completed, are then reordered and output back to the program via the processor.
Branch prediction is the next step up from OoOE. This looks at each branch in a program’s code, analyzes it, then tries to predict which unit each branch of instructions should be placed into.