Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests - Download the BYJU'S Exam Prep App for free GATE/ESE preparation videos & tests -

Memory Management Requirements

Memory management helps in keeping track of each memory location’s status – whether it is free or allocated. It helps in the dynamic allocation of memory to all the programs at their individual request and frees them for reuse when they aren’t needed any longer. The process of memory management is meant to satisfy a few basic requirements.

In this article, we will look more into memory management requirements according to the GATE Syllabus for (Computer Science Engineering) CSE. We will read ahead to find out more about it.

Table of Contents

What are the Memory Management Requirements?

Here are the requirements of memory management:

1. Relocation

The memory available to us gets shared among various processes present in a multiprogramming system. Thus, it is impossible to determine what other programs would reside in our main memory during the program execution. If we swap the active processes in and out of the main memory, it lets the OS have a bigger and better pool of processes that are ready to execute.

Whenever any program happens to swap out to its disk memory, it would not always be possible that swapping it back into the main memory would let it occupy the previous memory location. It is because the location might still be occupied by some other process. We might have to relocate the given processes to a different section of the memory. Here, there is a possibility that the program might be moved to the main memory because of swapping.

Memory-Management-Requirements

The figure given above depicts the image of a process. This processed image occupies a main memory’s contiguous region. The OS would like to know multiple things, including the process control information location, the code entry, and even the execution stack. There are various memory references within a program in various instructions, and they are known as logical addresses.

After the program gets loaded into the main memory, the OS and the processor should be able to translate the logical addresses into the physical addresses. The branch instructions consist of the address of the next instruction that has to be executed. The data reference instructions consist of the addresses of the word or byte of the referenced data.

2. Protection

Whenever we are dealing with multiple programs at the same time, there always exists a danger – one program might write to the address space occupied by another program. Thus, every process has to be protected against all unwanted interferences when all the other processes try to write into a process, whether it is accidental or incidental. Now, between the requirement of relocation and protection, a trade-off occurs – the satisfaction of the requirement of relocation makes it more difficult to satisfy the protection requirement.

The prediction of a program’s location in the main memory isn’t possible. Thus, it is impossible for us to check the absolute address at the time of compilation in order to assure protection. A majority of the programming languages allow dynamic calculation of the addresses at the run time. The requirement of memory protection has to be satisfied by the processor instead of the OS, since the OS can hardly control any given process whenever it occupies the processor. Hence, it is possible for us to check the validity of a memory reference.

3. Sharing

Some protection mechanisms allow various processes to access a similar section of main memory. Thus, it allows all the processes to access the very same copy of the program instead of having their own separate copy, which has an advantage.

For instance, numerous processes may utilise the very same system file. It is natural to load a single copy of the given file in the main memory and to let it be shared by these processes. It is the memory management’s task to allow the shared areas of memory with controlled access without compromising the protection. Various mechanisms are utilised here to support the relocation-supported sharing abilities.

4. Logical Organization

The main memory is organized as a linear form, or it could be an address space that’s one-dimensional. It comprises a sequence of words or bytes. A majority of programs could be organized into modules, and some of them are unmodifiable (execute only, read-only), and some of them consist of modifiable data. To deal with any user program effectively, the OS and the computer hardware have to support a basic module. This way, it provides the required sharing and protection. It comes with the following pros:

    • Modules are independently written and compiled. All the references from a single module to another one get resolved by a system at the run time.
    • Different degrees of protection are provided to different modules.
    • Various mechanisms are there by which the modules could be shared among various processes. Sharing can be available on a module level, letting the user specify the desired sharing.

5. Physical Organization

A computer memory’s structure has two levels, and they are referred to as the main memory and the secondary memory. Here, the main memory is relatively costly and much faster than the secondary memory, and the main memory is volatile. Hence, the secondary memory is mainly used for data storage on a long-term basis, but the main memory holds the currently used programs. The primary system concern between the secondary memory and the main memory is the information flow. It is impractical for a programmer to understand this because of the following two reasons:

    • A programmer may engage in overlaying whenever the main memory is available for a program, and also, its data might be insufficient. Different modules are allowed to be assigned to a similar memory region. A primary disadvantage of this is that it is time-consuming for any programmer.
    • In a given multiprogramming environment, a programmer won’t know the amount of space that might be available during coding time and also the location of that space inside the memory.

Keep learning and stay tuned to get the latest updates on GATE Exam along with GATE Eligibility Criteria, GATE 2023, GATE Admit Card, GATE Syllabus, GATE Previous Year Question Paper, and more.