In this tutorial, you will learn about different ways to manage memory and how it works. Memory management algorithms range from basic techniques to complex paging and segmentation policies. Each method has its advantages and disadvantages. The choice of memory management technique for a specific system depends primarily on different factors, especially the system's hardware design. Nowadays, many techniques require hardware support, and recent designs closely integrate the hardware and operating system.

Basic Hardware

Main memory and different registers built inside the processor itself are the only primary storage that the CPU can have the right to use directly by accessing. Some machine instructions take memory addresses as arguments or values, but none of them can take disk addresses. Therefore, any instructions and data the instructions use should be in one of the direct-access storage devices. If the data is unavailable in the memory, it must be moved there before the CPU can perform any operations on it.

The CPU has registers that can be accessed within a single cycle of the CPU clock. These registers contain data the CPU can quickly interpret and perform operations. This process can occur at a rate of one or more processes per clock tick. However, accessing the main memory is different. It requires a transaction on the memory bus and is not as fast as accessing the CPU registers.

Address Binding

Generally, a program is stored on a disk in the binary executable form of a file. To run, the program needs to be loaded into memory and placed within a process, which is then added to a queue. Depending on memory management, the process may be moved between the disk and memory while running. Processes stored on the disk wait to be loaded into the main memory for execution from the input queue. The standard method is to select any process from the input queue and load it into memory.

When a process is executed, it can access instructions and data from memory. Once the process is completed, the memory space is declared available or free. In most systems, user processes can exist in any part of the physical memory, meaning that the first address of the user process need not be the same as the computer's address space. However, this approach can affect the addresses that the user program can use.

Usually, the binding of instructions and data onto memory addresses can be done at any of the steps given below:

  • Compile time: Compile time is the phase where the process will reside in memory, and eventually, absolute code can be generated.
  • Load time: At compile time, when the process will reside in memory, the compiler must generate relocatable code. In that case, the final binding gets delayed until load time.
  • Execution time: Execution time is when a program or instruction takes to execute a particular task.

Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram