Memory Allocation

Memory Allocation

Memory Allocation

Memory allocation
OS Memory Management

 

Memory allocation, The main memory must accommodate both the operating system and the various user processes. We need to allocate different parts of the main memory in the most efficient way possible.

The main memory is usually divided into two partitions: one for the resident operating system, and one for the user processes. We may place the operating system in either low memory or high memory. The major factor affecting this decision is the location of the interrupt vector. Since the interrupt vector is often in low memory, programmers usually place the operating system in low memory as well.

There are following two ways to allocate memory for user processes:

  1. Contiguous memory allocation
  2. Non-contiguous memory allocation

 

  1. Contiguous Memory Allocation

Here, all the processes are stored in contiguous memory locations. To load multiple processes into memory, the Operating System must divide memory into multiple partitions for those processes.

Hardware Support: The relocation-register scheme used to protect user processes from each other, and from changing operating system code and data. Relocation register contains a value of the smallest physical address of a partition and limit register contains the range of that partition. Each logical address must be less than the limit register.

Hardware support for relocation and limit registers

(Hardware support for relocation and limit registers)

 

According to the size of partitions, the multiple partition schemes are divided into two types:

  1. Multiple fixed partition/ multiprogramming with a fixed task(MFT)
  2. Multiple variable partition/ multiprogramming with the variable task(MVT)

 

  1. Multiple fixed partitions:

    Main memory is divided into a number of static partitions at system generation time. In this case, any process whose size is less than or equal to the partition size can be loaded into any available partition. If all partitions are full and no process is in the Ready or Running state, the operating system can swap a process out of any of the partitions and load in another process, so that there is some work for the processor.

Advantages: Simple to implement and little operating system overhead.

Disadvantage:    *   Inefficient use of memory due to internal fragmentation.

*    Maximum number of active processes is fixed.

  1. Multiple variable partitions:

    With this partitioning, the partitions are of variable length and number. When a process is brought into main memory, it is allocated exactly as much memory as it requires and no more.

Advantages: No internal fragmentation and more efficient use of main memory.

Disadvantages: Inefficient use of processor due to the need for compaction to counter external fragmentation.

 

Also read:- Partition Selection policy

Also read:- Fragmentation.

Also read:- noncontiguous memory allocation.

 

basicittopic

basicittopic

A Computer Science Study for IT students and people of IT community