Memory Management in Operating System

By | October 21, 2021

Introduction

  • A computer uses two types of storage : main memory and secondary memory.
  • Main memory temporarily stores data and instructions to be executed by the computer. The CPU retrieves the instructions from main memory & executes them.
  • As main memory is usually too small to accommodate all the data & programs, the information is stored in various secondary storage devices such as magnetic disks and magnetic tapes in form of files.
  • The part of operating system that manages the memory is called the memory manager.

The memory manager performs the following function :

  1. To keep the track of which parts of memory are in use and which are free.
  2. To allocate memory space to processes when they need and to deallocate it when they are done.
  3. To manage swapping between main memory and disk when main memory is not big enough to hold all the processes.
  4. To protect various processes so that they do not interfere with each other’s operations.
  5. To enable sharing of memory space between processes whenever required.
  6. To make the addressing of memory space as transparent as possible from the programmers.

In order to implement these functions memory manager uses variety of memory management schemes :

1. Contiguous, Real Memory Management System

  • Single Contiguous Memory Management System
  • Fixed Partitioned Memory Management System
  • Variable Partitioned Memory Management System

2. Non-Contiguous, Real Memory Management System

  • Paged Memory Management System
  • Segmented Memory Management System
  • Combined Memory Management System

3. Non-Contiguous, Virtual Memory Management System

  • Virtual Memory
  • Paging Virtual Memory Segmentation

Memory Management in Operating System

  • In Contiguous memory management schemes program is loaded in contiguous memory location.
  • In non-contiguous system memory locations allocated to program can be non- contiguous. They allow the program to be divided into different chunks and loaded into different portions of memory
  • In paging, these chunks are of same size whereas in segmentation, these chunks can be of different sizes.
  • Virtual memory management system starts executing a process even with only a part of the process image loaded in the memory.
  • The main memory or RAM consists of a large array of words or bytes.
  • Here, each byte has a particular address. The addresses are usually sequential hexadecimal numbers.

There are two different ways of mentioning a memory address in an instruction:

  1. Absolute address
  2. Relative address

Absolute address : In absolute addressing, an exact location of the byte of RAM is mentioned. For example, the address 2240 indicates a specific location in the RAM.

Relative address : In relative addressing, the location of byte in RAM is obtained by adding a displacement to a base address or root address. For example, if the base address is 2422 then the addresses of other instructions are obtained by adding displacement to 2422. If displacement is 3, then the address is 2422+3 = 2425

One thought on “Memory Management in Operating System

  1. Pingback: Difference between Paging and Segmentation »

Leave a Reply

Your email address will not be published. Required fields are marked *