Memory allocation is the procedure of allocation of memory to the various processes. A simple technique is used for memory allocation in which allocating memory is divided into several fixed size partition. A process can have exactly one memory portion. The number of partition bounds the degree of multiprogramming. In case of multi-partition technique when a partition is free a selected process form ready queue can be load into this partition. After the termination of that process the memory partition become available for another process. A table is used by operating system to keep the track of memory partition to make sure which partition is free and which one is reserved.
Initially all the memory is available for user which is considered as a large block of memory which is called as hole. The processes are put in to the ready queue as they entered. The operating system takes into account the amount of memory required for every process in the ready queue and according to their memory requirement determining which processes are allocated memory. Operating system deallocate the memory when a process completes its execution. Main memory is usually consisting of two partitions which are:
- Low memory
- High memory
The memory in which operating system resides is called as low memory.
The memory space in which holds the user processes is called as high memory.
Operating system use two techniques for memory allocation which are:
|This technique uses the reallocation registers scheme for the protection of user processes form each other and from changing operating system codes and data. relocation register contains smallest physical address’s value and limit register holds the range of logical address.|
|In this allocation technique main memory is divided into a number of fixed size partition where each and every should contain only one process at a time. Memory partition is allocated to the process from the input queue when the partition is free.|
Memory allocation process is shown as:
In case of dynamic memory allocation means when process required dynamic size of memory partition there occurs a problem which is called as dynamic storage allocation problem. This problem concerns with how to satisfy the request of n size hole from list of free holes. Usually three solutions of this problem are used which are
- First fit: Allocation of first hole which is big enough in space. Searching can begin from the start of the hole’s list or from where the previous searching is ended.
- Best fit: Allocation of smallest hole which is large enough. Searching is done at the entire list of free holes unless list is ordered by size.
- Worst fit: Allocation of allocation of largest hole in the list. Entire list is searched unless it is sort by size.