What is the main memory of the computer and how it works? You are on the right spot to know the answer of this question.
The main memory of a computer is a Random Access Memory or RAM memory, works in a rather peculiar way that not many users are aware of.
In this article you will be able to understand how it does work and how the operating system manages it explained in a simple way.
See Also: What is STT RAM Memory
Table of Contents
What Main Memory is for?
Main memory is simply an intermediate storage space between the CPU and secondary memory, that is, mass storage media such as a hard drive.
Therefore, the main memory or RAM is going to be in charge of loading everything that the CPU needs to “feed” and execute the programs: data and instructions.
These data and instructions are stored in the form of processes, with spaces reserved for each process with all the necessary instructions and data needed to execute a given program.
The idea of this memory is that the CPU does not have to look for the information in secondary media, which are slower than RAM in terms of access. This reduces latency and increases computer performance.
How main Memory works with the Operating System?
Computers are made up of a memory hierarchy that works in concert with the operating system to move all the information that is needed to run the software.
One of the key elements of that memory hierarchy is called RAM or main system memory. But could you tell how it works?
What are Memory Accesses?
Any reading or writing action in memory is called memory access. Without going into concepts such as paging, segmentation, etc. It’s that simple, any operation that reads or writes information is considered an access.
-
Virtual memory
To be clear about how main memory works, it is also necessary to be clear about the concept of virtual memory. Well, a CPU can address X amount of memory, that is, X number of possible addresses.
And within that address space there is not only RAM, but in theory, systems are designed so that programmers have memory almost infinite thanks to virtual memory.
This is achieved through an architecture that makes RAM or main memory and secondary memory appear as one uniform storage space to the programmer.
See Also: HBM2 vs. HBM3 (High-Bandwidth Memory)
Or rather, that the space reserved in Windows to Pagefile.sys, or the SWAP or exchange memory in Unix-like systems, and the RAM memory are an extension even though physically they are not.
From the hardware point of view, the CPU will have to translate real memory addresses to virtual ones and vice versa, when it wants to work with the active programs. This is what the TLB and MMU would do, although these are other topics.
-
Large Programs
When very long and heavy programs are developed, they would consume a large amount of the available RAM memory, and would not allow other processes to load, or at least not too many.
That is why what is known as overlay is performed, that is, dividing the program into processing blocks that will be moved to or from RAM/virtual memory.
For example, imagine that a program is made up of 5 modules or blocks. It may be that 1 and 2 are loaded in RAM and 3, 4 and 5 are in secondary memory.
That is, in that Pagefile.sys or in the SWAP waiting for there to be room in RAM to upload them to it and be processed by the CPU.
-
The Scheduler or Kernel Scheduler
The kernel of the operating system has a part that is responsible for managing these process movements. It is called a scheduler or planner.
It allows prioritizing one process or another by means of an algorithm to load or unload them from RAM memory as desired at any given time.
So why do I need more RAM?
You may think that if you have seemingly infinite memory, why need larger and larger RAMs? Well, the higher the RAM, the more processes it can hold and the faster it will deliver what it needs to the CPU, so it will have more performance.
See Also: In-Memory Vs Near Memory Computing
However, a small RAM memory would need to pass too many processes to swap memory, making them slower.
Also each software has its own memory requirements to function properly, therefore, your computer should meet the minimum requirements to function as expected and smoothly.
What happens if it didn’t meet the Requirements?
In principle, depending on the software, it could even run if the minimum requirements are not met. It would do so poorly, overloading the system, degrading performance, raising temperatures, and generating other problems such as crashes, etc.
However, some other programs won’t even run if they don’t meet the minimum requirements specified by their developer. This occurs in the case of the most demanding, such as some video games.
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.