As an Amazon Associate I earn from qualifying purchases from amazon.com

Where does the CPU store its computations? 



Last Updated:

CPUs are complicated. Understanding CPUs completely can be a daunting undertaking for anyone, but we’re here to help. In this article, we will discuss where CPUs store computations, and outline exactly what a “computation” is. We will delve into the instruction cycle and its components, along with explaining what RAM is and its role in the process. But where does the CPU store its computations?

What is a computation? 

A computation by definition is just the action of a mathematical calculation because essentially that’s all CPUs are, number crunchers. 

When you give a CPU instruction, the processor will “process” that instruction and spit out a string of ones and zeros – binary code. CPUs consist of logic gate transistors that are capable of two values, yes, and no. The way binary code is converted is that a yes means one and a no means zero – binary code is the fundamental language of computers. 

Where does the CPU store its computations? 

The short answer to this question is cache and RAM. A CPU stores its computations in both RAM and cache ready to be used by whatever component requires them. 

Let’s face it, this is a pretty niche question, so it’s probably on a computer science test somewhere. That’s probably all you need to know to pass the question, but if you’re interested, we’re going to explain it a little further, as there are a few more factors at play. 

The CPU utilizes something called registers to store its computations. This serves as a form of temporary memory for the CPU – it is incredibly fast, but also very small. There are a few types of registers that hold different types of data, but knowing them all isn’t imperative. 

After the result of the computation has left the register, it is stored in the cache and system RAM. 

You might be wondering, “What’s the difference between cache and registers?” Well, good question. 

What’s the difference between registers and cache? 

The difference is that registers are built closer to the CPU and are only used to store and retrieve specific information. Unlike cache, registers can be accessed more than once per clock cycle. You can think of registers as something that comes before the CPU cache. 

To understand the differences further we need to briefly explain what a CPU cache is.

Cache  

A CPU cache is a form of volatile memory, volatile meaning it forgets what’s stored in it when unpowered. The opposite applies to non-volatile memory, such as SSDs. This type of memory doesn’t forget data until it’s overwritten. 

The cache is constructed close to CPU cores, for speed and ease of access. Cache memory usually consists of three levels, L1 cache, L2, and L3. All three of these levels serve a specific function and they are configured differently. This is the temporary storage that the CPU uses to input and fetch data that it might need again.

Level one cache is the smallest capacity and has the fastest speeds. This is where crucial CPU instructions are stored for faster access speeds. 

Level two is a nice middle ground between L1 and L3, with medium capacity and medium speeds. This is where less crucial CPU instructions are stored but will still benefit from fast access speeds. 

Level three has the highest capacity and is much slower in comparison to the other levels (but still fast compared to RAM). This is where frequently used paths like application paths are stored to give your CPU a boost when accessing frequently used data. 

Back to registers 

A register is on a lower level than the cache, and it can be thought of as an L0 cache level. A register is significantly smaller and faster than even a level one cache. Most data registers can only hold some calculations and partial results. For example, when multiplying, a register will store intermediate results and calculations whilst the CPU is calculating until it gets to the final result. 

Both registers and cache memory are vitality important, without either of them, CPUs would be incredibly slow and inefficient. If the CPU didn’t have any cache memory then the CPU would have to pull all its instructions from RAM, and that is much slower than cache. 

Final word

Now you know that CPU computations are stored in registers specifically, however, you wouldn’t be too far off saying that computations are stored in CPU cache, as this also plays a crucial part. Your CPU needs registers to hold and fetch tiny amounts of data very quickly. It also needs different cache levels to hold data, as these cache levels have a much higher capacity than registers. 

The difference between the two is that registers are faster and closer to the actual chip. The similarity is they are both significantly faster and integrated closer to the CPU than RAM is. Also, both of them reside within the actual CPU itself. 


We will be happy to hear your thoughts

Leave a reply

Sharkr
Logo
Enable registration in settings - general
Compare items
  • Total (0)
Compare
0
Shopping cart