Are you up for looking what is memory of a computer and different types of computer memory? You are on the right spot to know the answer of this question.
The memory of a computer, although it is on the lips of all users, is still completely unknown to many of them.
For this reason, here you will be able to see the complete memory hierarchy of a computer and the types of memory that intervene during the processes that are normally carried out with these computers, as well as the objective of each of them.
See Also: What is the Main Memory of the Computer
Table of Contents
Types of Memory of a Computer
The definition of a computer is clear: It is a system capable of processing data from instructions or programs, and is basically made up of a CPU, memory, and I/O at the hardware level, with an operating system and programs at the system level, software. Well, if we focus on memory, the hierarchy you should know is:
-
Records
The ISA of a computer defines the instructions, the accepted data types, the addressing modes, and also the registers.
Precisely those CPU registers are the first to deal with, since it is the smallest and fastest memory that exists in the hierarchy.
The registers are located inside the microprocessor, in the form of banks. Its purpose is to store small amounts of information, a few bits or binary data, such as instructions or data.
Each CPU can have quite a number of them, with different purposes. For example, some of the most common are:
- Register for Data
They can store data or operands as their name indicates. Some of them are used to store integer or floating point data, others only for one of these two types.
- Register for instructions
This intended only to store instructions, that is, the operations that will be applied on the data or operands. These registers will store codes that the control unit must interpret.
- Address Registers
As the name suggests, they serve to store memory addresses.
- Status Registers
They are the ones that store the so-called flags or flags. One of these flags will be bits that determine the state of something, such as whether an addition operation had a carry or not, for conditions, etc.
- General Purpose Registers
They are the opposite of specific purpose registers, being able to store information of any type, such as instructions, data, addresses, etc.
- Register Program Counter or PC
It is a very important register, and is responsible for pointing to the next address of the instruction to execute.
As you know, a program is made up of a series of instructions and data that must be executed sequentially.
To do this, the PC register is responsible for adding +1 to the current address, thus pointing to the next instruction to execute, and so on until the program is finished processing.
See Also: Capacity of a Ram Memory
Regardless of the type, what is interesting here is to highlight that it is a memory with very little capacity, but the fastest of all.
Also, being so close to the CPU’s execution units, latency is minimal, and stored information can be transferred or written extremely quickly.
The drawback is that these bistable cells are more expensive to produce, which is why they have capacities as small as 32, 64, 128-bit, etc.
Producing one of these memories with capacities of GB or TB would be a total nonsense when it comes to the price they would reach.
-
Cache
In the micro-architecture of the CPU, another of the most important memories is the cache memory. It is also located near the CPU.
Generally on the chip, although in the past there were off-chip models. The idea of this memory is to act as an intermediate buffer between the main memory and the CPU, in order to reduce the impact of latency, increasing performance.
This memory is also expensive to manufacture, it is a type of SRAM made up of transistors, and it is very fast in terms of access.
Its capacities are somewhat higher than the records, with a few KB or MB, but they continue to maintain a lower capacity than other types of slower and cheaper memory, such as RAM.
Depending on the CPU, the cache can have several levels, the lower the number that accompanies the level, the closer to the processing core and the faster it tends to be, thus reducing latency.
See Also: How RAM Memory Works
For this reason, the data or instruction will always be searched for at the lowest level. If it is not there, what is known as a cache miss occurs and the immediately higher level is searched, and so on until the required information is obtained? The most common are:
- L0: It is a very small memory, like an operations register, with only a few bits, and it can be directly accessed by the functional units. However, this level is not present on many CPUs.
- IL1: It is the L1 cache for instructions, since the L1 is usually divided into two.
- DL1: Is the L1 cache for data.
- L2: Is the next level, larger than L1 and unified, so it can store both data and instructions. In addition, it is usually slower than the L1 and more distant from the control unit.
- L3: The level immediately above L2, also unified and larger and again further away.
- L4: Some systems also usually include an L4, although in some cases it is not on-chip, but off-chip.
- LLC: Last Level Cache refers to the last level of a system’s cache, whatever it may be. For example, those that only reach the L2, the L2 will be the LLC. If they have L3 and not L4, the L3 will be the LLC…
I wouldn’t want to forget the TLB (Translate Look aside Buffer) either. This element is also usually divided into levels in some cases, and separated for data (DTLB) and instructions (ITLB).
This memory, managed by the MMU, is also fast and closely related to the cache. They are usually tables with a few KB of information.
Specifically, it contains parts of the paging table with the relationship between logical and physical addresses.
-
Main Memory
The main memory or RAM memory would be the next level of the hierarchy. It would be above the cache, slower than the cache, and larger in size.
While the cache was only a few MB, the RAM can be several GB. As you may already know, it is a type of SDRAM memory that maintains data while power is being supplied to it.
The CPU works much faster than this, and to avoid bottlenecks, buffers have been implemented like the ones seen in the previous section.
And it is that the CPU must use more cycles to access the RAM than to access any level of cache. Therefore, if it is in cache, it is preferable to access it from there.
This memory is also generic and any type of information can be stored in it. It usually has the kernel of the operating system loaded, which is always running, and also the different processes or programs running (or some of them).
See Also: How to Repair RAM Memory
Both the kernel and the programs are software, and they are all made up of instructions and data to be processed by the CPU.
-
Secondary Memory
It is the next level to the primary memory. Secondary memory refers to mass storage media, a memory with a much higher capacity, but much slower in terms of access (reading and writing).
For example, it can be the HDD or SSD hard drive, a memory card in some cases, etc.
Capacities here range from several hundred GB to TB. And they are not only used to store user data or installed programs.
They also have a very important reserved part, such as virtual memory or SWAP that expands the capacity of RAM beyond its physical capacity limits.
In this way, before the “eyes” of the program, the computer will have infinite memory.
The kernel of the operating system, by means of some algorithms, specifically the planner or scheduler, will be in charge of uploading the highest priority processes from this memory to RAM.
And, if necessary, downloading the lowest priority processes from RAM to secondary memory.
Put crudely and simply, when you run a program, the kernel will send it to RAM, and from RAM it will go to the CPU for processing.
However, if said program loses priority and more urgently needs another one for which there is no space in RAM.
The previous process is unloaded and the one with the highest priority is uploaded to be processed.
-
Input and Output
Although it seems strange to many users, the I/O or input and output system of a computer is also part of this memory hierarchy.
In fact, the CPU sees it as just another memory. That is, a keyboard connected to a computer, or a printer for the CPU memory.
In the first case it is a memory that must be read (to know the characters that are being typed), and in the second case it is a memory that must be written (send the file to print).
Therefore, the I/O also has an address space reserved for it. And, in these cases it is also a somewhat slower memory.
Although given the heterogeneity of the possible peripherals, it does not necessarily have to be of greater capacity. In most cases it is not.
DMA (Direct Memory Access) should also be introduced here. Direct memory access is a technology implemented decades ago that allows the system to access (read and write) the system memory directly without the need for the CPU to intervene in the process, in order to offload this work and speed up processes.
See Also: How to change RAM memory on PC
When we talk about a DMA transfer we are referring to transferring a block of data from one device to another. Instead of the CPU initiating the transfer, this job is done by a chip known as a DMA controller.
Of course, although the CPU does not intervene, the system bus is used to carry out the transfer, so if there is a need for the CPU to use it, its use will have to be regulated.
And with DMA and all these memory hierarchies, as well as parallel multiprocessing, a big problem arises, such as maintaining memory coherence.
What do you think would happen if a device accesses a memory address and writes data to that address before the CPU makes use of said data?
It would be processing an erroneous data, of course, and this must be avoided at all costs.
Zahid Khan Jadoon is an Interior Decorator, Designer and a specialized Chef and loves to write about home appliances and food. Right now he is running his interior designing business along with a managing a restaurant. Also in his spare time he loves to write about home and kitchen appliances.