As we know that operating system is that which executes the system and the operating system is the software which is responsible for running all the user programs so that generally memory is divided in to the two parts, first part is used by the operating system and the second part is used by the user programs and there may be some situations that the memory size of the operating system may be higher from the user memory and also vice versa.
So that there must be some mechanism in which a user can’t access the data of the operating system and there must be some mechanism. That mechanism contains two types of registers.
1) Relocation register: the relocation register is the smallest register which contains the smallest value of the physical address.
2) Limit register: the limit register is that which contains the highest values of the address of physical memory.
When we use the static memory allocation then all the memory is provided to the various process will be in the continuous form and when any process ends then the memory of that process will not be allotted to any new join process, because memory is already to all the processes, so this will create the problem of internal fragmentation means there is not enough memory available, which can be allocated to the processes, so that we uses the dynamic memory allocation, in this memory which is allocated by the processes in the form of needs and dynamic demands of the process and in this when a process ends then the memory of that process will be provided to the process which is newly join and the memory is provided to the process by using the compaction means after providing the memory space to each and every process , this will refresh the memory or will uses the process of compaction and in this all the free memory will make a single large memory so that the memory will be provided to the process those are newly created. For providing the memory to the various processes there are three methods or techniques-
1) First fit: in the first fit the operating system will search for the free memory or available memory from the entire memory and this will select the first area or first part of the memory and in this first part which is large enough for the process will be provided to the process.
2) Best fit: in this operating system will search for the memory area which is small as well as enough for the process. Will be provided to the process. And in this all the memory holes or parts are arranged in to the sorted order and the operating system will search for the best whole means this will search for the smallest hole or part from the memory.
3) Worst fit : in the worst fit we uses the largest hole for the process and in this the memory area which is large enough means which is greater from the required area will be allocated to the process.