The user continously load or unload the processes from main memory. processes are stored in the form of block in main memory. when there are some free blocks but not enough to load the process then the situation arrises known as fragmentation.Fragmentation occurs in dynamic memory allocation system where many of the free blocks exists and are too small to satisfy or fulfill the request.
There are two types of fragmentation
- External Fragmentation
- Internal Fragmentation
1. External Fragmentation
- In variable partition allocation, each process is allocated exactly the same amount of memory it requires.
- In such a way processes after finishing their execution leave the memory and some new processes are loaded in the same space.
- As the memory requirement of different processes is not same, the swapping of different processes results in the formation of unusable memory holes. this is known as external fragmentation.
- It is called external fragmentation as the memory space is wasted external to the allocated memory partitions.
2. Internal Fragmentation
- In fixed partitioning, the various partitions can be of same size or different size.
- Whenever a new process arrives & needs memory, it is allocated a partition large enough to hold the process.
- However, the size of partition may be large than the size of the process. in such a case a part of memory partition goes waste and remain unused . such an unused space called fragment.
Thus, the allocation of a process to a partition greater than the process’s requirement results in the wastage of space internal to a partition. this is known as internal fragmentation.
it is called internal partition because the memory is wasted within the space allocated to process i.e internal to a partition.