Day 102 - Memory Allocation Methods

The program code has to be transferred from secondary storage like HDD or SDD to the main memory to be executed. This task is called process loading. Same thing in reverse also happens to accomodate multiprogramming by swapping processes that are not being executed from the main memory to the secondary stroage and swapping the processes in the main memory to execute them. This is done by swapper. and is called swapping.

In order to swap process into the memory we first need to allocate memroy for them in the memory. There are three schemes to do memory allocation.

Single Process Allocation Scheme

In Single Process Allocation Scheme, only a single process is executed by the CPU at a time. Memory management is simple in SPA Scheme as only one process is needed to be loaded in the memory which we want to execute. All other memory is left free and will not be used.

In this scheme as only one process is executedd at a time, only limited computation is done. It is only used in small systems like some electronic devices and games etc.

Fixed Partition Allocation Scheme

This scheme divides the memory is small fixed areas where each area can hold only one process at a time.

The small areas of the memory are decided by the OS and depends on many things. For example, one partitions should be big enough for the biggest process to fit in and still some space left. This left space is called internal fragmentation and is wasted and not used. It is called internal because it occurs in the space that is allocated to the process.

Typically, the partitions are set up with a wide range of sizes so that the processes of size small and large are all accommodated. This scheme is one of the first schemes to be used in multiprogramming systems.

Variable Partition Allocation Scheme

The solution to all the problems of Fixed Partition Allocation is to allow variable partition allocation at loadtime. it allocates the exact amount of memory to all the processes as required. Processes are loaded into consecutive areas until the memory is filled or the remaining space it till small to accommodate another process.


zainscizainsci