Memory management is the process of keeping track of the free and allocated blocks of the RAM and assigning the free memory blocks to processes.
Memory partitioning means dividing the main memory into chunks of the same or different sizes so that they can be assigned to processes in the main memory.
There are two types of memory partitioning techniques:
In fixed-sized memory partitioning, the main memory is divided into blocks of the same or different sizes. Fixed-size memory partitioning can take place before executing any processes or during the configuration of the system.
Consider an example of a main memory of 80MB. Let’s suppose that the main memory is divided into blocks of 10MB as shown below:
The operating system is assigned the first block in the memory.
Let’s say we bring 3 processes, process 1, process 2, and process 3, from hard disk to main memory. Process 1, process 2, and process 3 are of sizes 6MB, 8MB, and 5MB respectively.
To assign the processes in the main memory, the operating system will try to find a single block that is large enough to store the process. In other words, the operating system will find a block whose size is greater than or equal to the size of the process. After loading the three processes into the memory, the memory will look like this:
Consider the example of three processes, process 1, process 2, and process 3, of sizes 6MB, 8MB, and 5MB respectively. The processes will be assigned to a memory of 40MB divided into blocks of 10MB, as shown below:
Notice that the memory blocks are not utilized completely. Process 1 consumes 6MB and is assigned to a block of size 10MB; this means that 4MB memory remains unutilized. Similarly, 2MB and 5MB memory is unutilized by 10MB memory blocks assigned to process 2 and process 3. Thus, out of 40MB of main memory, 4+2+5=11MB of main memory remains unutilized.
Let’s suppose we try to load another process, process 4, of size 6MB in the memory. Although we have 11MB of free memory space, the process cannot be loaded into the memory. This is because we need a contiguous block of 6MB to load process 4.
Consider the example of three processes, process 1, process 2, and process 3, all of size 10MB. The processes will be assigned to a memory of 40MB divided into blocks of 10MB as shown below:
Now consider that process 1 and process 3 have freed the memory blocks because they have completed their execution. After removing process 1 and process 3, the main memory explained above will look like this:
Let’s suppose we try to load another process, process 4, of size 11MB in the memory. Although we have 20MB of free memory space, the process cannot be loaded into the memory. This is because we need a contiguous block of 11MB to load process 4.
The degree of concurrency means the maximum number of processes that can be loaded into the main memory at the same time.
The fixed-sized partitioning limits the degree of concurrency. The maximum number of processes that can be loaded into the memory at the same time is equal to the number of fixed-sized partitions of the main memory.
The fixed-sized partitioning limits the maximum size of processes that are loaded into memory. Even if we have a main memory of 4GB, we cannot load a process of even 10MB if the maximum block size we have is 5MB.