A personal computer is an essential commodity that most of us possess. With a basic knowledge of them, we can comprehend that the CPU is a crucial component. Being considered as the central unit or Brain of the computer, it is responsible for various operations that a computer conducts. In this process of their performance, it makes many calculations. For instance, it may estimate and show all the prime numbers between 1 to 1000 if the user asks it.
In this accord, many users came up with an interesting query – where does the CPU store its computations? If you are looking for the answer to the same, look no further. In this post, we will dive into a detailed description of the same.
Registers – Where CPU Stores its Computations
If you ask where does the CPU store its computations, the answer would be Registers. All the computations made by the CPU are stored in one or another register, which is temporary and small memory used for various purposes.
A register is a temporary memory in the CPU. The function and build are nearly similar to that of a RAM or a cache. However, these are used especially to store computations made by the CPU. In computer architecture, these are very fast memories used to execute programs and operations.
Registers form an undivided part of the CPU architecture. One can add, remove or modify any of them since these are formed as minuscule storage that can be randomly accessed. While some can be read-only and some others can be written only, which are used in special occasions. Common sizes of a typical register include 8 bits to 64 bits each.
How Does A Register Work?
Registers are not basically a part of memory; rather, they are special subsidiary memory locations that offer speed as an advantage. These work under the guidance of control units by holding, transferring and performing arithmetic comparisons at high speed.
A CPU, when stipulated to make computations, retrieves data from larger memories and stores them in registers for easy access. Thus, these are freed up when new computation is initiated. Moreover, the functions can be determined based on the class of the registers. While some are used to store data, some may be used to store addresses.
Types Of Registers
Not all register store computation and similar values. These are classified into seven different classes based on their utility in the process of processing. Let us look into each of them:
- Accumulator: Being a basic and frequently used register, Accumulator is a data storing memory. These are in different numbers in various processors.
- Memory Address Register (MAR): As the name implies, these registers store memory addresses using which the data is fetched to the CPU. Generally, these are parallel load registers that mainly house the next memory address that needs to be manipulated.
- Memory Data Register (MDR): This register stores data that needs to be written into or extracted from the given location. Also known as the memory buffer register, this is known to store the data for the next clock cycle.
- General Purpose Registers (GPR): Modern CPUs have GPRs to store temporary data during the ongoing operation. The information stored in these registers may be accessed by assembling programming.
- Program Counter (PC): This register, as the name suggests tracks the execution of the program by housing the address of the next instruction. Sometimes, it also functions to count the number of instructions.
- Instruction Register (IR): While PC holds the address of the next instruction, IR holds the instruction that is about to be processed. The instruction from the PC is fetched in the memory and is stored in IR so that the CPU starts executing while the PC points to the next instruction.
- Condition Code Register (CCR): Stores the current value of the condition codes. It has five flag bits that are set by ALU (logical arithmetic unit) to hold the information of the operation that has just been executed. These can be Carry (C), Overflow (V), Zero (Z), Negate (N), and Extend (X).
How is Cache DIfferent from Register in storing Computations?
Some common features make many people confused between a Register and a Cache. While Caches are used during the reading and writing process from the secondary memory, Registers are used to store and retrieve information during operations. Registers are much smaller and faster compared to a cache. The smallest of cache memories (L1) is at least 2KB in size, whereas the smaller register is 8 bytes in size. CPU operations get more efficient with the use of the cache; thus, registers are often referred to as L0 cache, which implies to be the yet smallest form of cache.
While both these memories are present in the CPU, Cache is used to access memory at a faster rate and registers are operated for more than one operation in a clock cycle. Thus, in some instances, registers store intermediate results in the CPU calculations, which is not the case with the cache.
Role of RAM in CPU Computations
RAM is separate temporary hardware storage that is used to store currently used OS and other apps from HDD or other secondary storage to reduce buffering time and ensure smooth performance. While cache and Registers are internal storages of a processor or a CPU, RAM is external memory. Thus, RAM is not used by the CPU to store computations. However, it retrieves bigger data which otherwise is hectic to access again and again. To summarise, RAM does the same job as a cache but with larger sets of data. Thus, the presence of RAM ensures smooth input of programs to the CPU and thus leads to uninterrupted operation.
Thus, you must have understood the answer to your query where does the CPU store its computations? Registers are unique tiny memories that are responsible for storing data making computations faster. On a broader view, one cannot let slip the role of RAM and cache in CPU computations. While Registers form the base for storing computations, RAM and cache are often responsible for storing data retrieved from secondary memory. Thus, it wouldn’t be unfair to comment that a CPU needs both Register and cache for smooth and efficient operations.
You might also consider the DRAM on the storage SSD/HDD drive.
Also most all SSDs come with pseudo SLC NAND caches nowadays.
That’s a total of 6 (to 7; p-SLC) caches between the CPU/s and non volatile storage..! 🙂
Then there’s Primocache,
eBoostr, (works fine in Win 10)
Readyboost, (which speeds up dramatically with a ‘Flush () ignored’ write cache)