Re:Why do CPUs have multiple cache levels?
by joseraul on Monday August 08, 2016 @07:05AM
(#12246766)
Since the CPU has 180 registers (with only 16 names), why don't we need to push all 180 to store context?
[ Parent
| on HN ]
Re:Why do CPUs have multiple cache levels?
by Dylan16807 on Monday August 08, 2016 @07:41AM
(#12246921)
All that extra state is there to help overlap instructions on a time scale of nanoseconds. Every instruction has its own name->register mapping. If you're switching to kernel mode or maybe if you miss a branch or for whatever other reason, the CPU consolidates you back down to running one instruction. Once that happens, you only have one name->register mapping and all the registers have their correct values. The hidden state is reduced to nothing and you only have to save the "real" state of those 16.
Re:Why do CPUs have multiple cache levels?
by cfallin on Monday August 08, 2016 @11:24AM
(#12248475)
To expand on another answer here -- there are more values in the PRF than there are names because "old" instructions in flight can refer to outdated versions of architectural registers (the names). But a new instruction can only see the latest versions of the architectural registers, so only those 16 actually matter w.r.t. future execution: when we switch back to the task, its new instructions will ony need the 16 live values.