Where does the CPU store its computations?


You can also be interested in these:


CPUs are complex pieces of machinery. It’s a key part of any PC system, but most people have no idea what it actually does outside of how it helps keep your computer running. Not only does it process all the data that enters your PC, but it also sorts everything out into little lines of codes that we call computations. So this begs the question, where does a CPU store its computations?



We’re hoping to answer that question by breaking down how a CPU works with its many moving parts. When we’re done, we hope you’ll know more about CPUs than before, as well as why they’re a key component in your PC and what makes them tick. With that, let’s get straight into things!

Where does the processor store its computations?

The first thing to know is that all computations are stored inside what we call CPU registers. Registers are a form of temporary memory storage units, not unlike RAM. Where they differ however is in terms of size, speed and purpose. CPU registers are incredibly small and significantly faster than any stick of RAM, mainly to ensure that your PC is always running smoothly.

Registers serve different purposes based on what your CPU needs. For example, data registers hold numeric data, while status registers for truth values. It’s an incredibly efficient system thanks to the usage of optimizing compilers that boost the performance of executable programs. It allows programs to execute faster, while simultaneously reducing memory footprint, storage size and power consumption.

What are registers and how do they work?

When your CPU loads data from larger types of memory like system storage or its CPU cache, it pushes them into registers. This allows the data to get processed into computations that speed up the system processes. After this is done, the processed data is then pushed over to the system memory for storage, freeing up space for more data to be turned into new computations.

When it comes to memory hierarchy, CPU registers on the other hand sit at the very top being the fastest form of storage above caches. It’s this speed that really allows registers to work for computations, allowing the CPU to process data incredibly quickly and push out a result in mere nanoseconds.

While registers are very small, they also come in different sizes based on the number of bits they can hold. is measured by the number of bits that it can hold. Usually, registers come in 8, 12, 16, 32, and 64 bit sizes. Larger registers can be divided into smaller subsections, allowing the one large register to act as many smaller ones as needed.

As we mentioned earlier, there are a few different types of registers inside your CPU. They all serve different purposes and have different sizes, though they retain the basic concept of being tiny, powerful storage units. We’ve done a basic breakdown of each type of register below to make things easier to understand.

1 – User-accessible register

User-accessible registers are designed to be read or written by machine instructions. They serve as the backbone for automating most tasks on your system. They also come in a few different variants, based on the type of information they hold inside them.

  • Data registers: Contains numeric values, bit arrays, numeric values and various bits of data.
  • Address register: Used to hold addresses for the main memory.
  • General-purpose registers: As the name implies, can be used as data or address register based on what the CPU needs at the time.

2 – Internal registers

Unlike user-accessible registers, internal registers cannot be accessed by instructions. These are only for internal processes that the CPU carries out by itself. They hold instructions instead, keeping them ready to be executed by the processor. These also come in different variants, including instruction registers, memory buffer registers and memory address registers.

Instructions cannot access these registers; they can only be used for processor operations internally. Some of the main types of internal registers are- instruction register, memory buffer register, memory address register.

3 – Architectural registers

These registers generally do not correspond to the physical hardware as they are visible to the software-defined by architecture. Architectural registers are system dependent and serve very specific purposes defined by their system architectures instead of any executable program.

Registers vs caches

Registers aren’t to be confused with CPU caches, however. While it’s true caches are very similar to registers in that they hold data for the CPU, caches function differently and serve a different purpose. Where caches are certainly fast, they still don’t reach the speeds of registers. On top of that, they function more like RAM in that they help the CPU recall recent data instead of store computations.

There are also different types of CPU caches, each with its own purpose and size. Most CPUs these days feature at least a data cache, an instruction cache and a translation lookaside buffer or TLB. These come layers and sizes of L1, L2 and L3. L1 is the fastest and smallest, while L3 is the largest and slowest. Despite this, L1 caches are still larger and slower than registers, hence why they can’t be used for computations.

Despite this, both are essential parts when it comes to keeping a CPU running smoothly. Registers cannot function without caches keeping the CPU in check, and the combination of the two allows your CPU and PC to run with maximum efficiency.

Conclusion

We hope this read helped you understand more about CPUs, where computations are stored, and the inner machinations of registers. While the world of PCs and how they work can be intimidating, with enough time and effort, anyone can come to understand the complex processes behind these common everyday appliances.

The world of caches, registers and computations is daunting, but having a general idea is always good. Now when you go out to buy a new CPU for your system, you’ll have a better understanding of the complicated details on that spec sheet and make a smarter choice.


More stories like this