
Introduction
The operating system manages a computer’s memory through memory management. To ensure that primary memory is utilized effectively, the memory management feature keeps track of the position of each memory location, either allocated or free. There is a technique called contiguous memory management technique, which is divided into two types:
- Fixed-size Partitioning
- Variable size Partitioning
What is Fixed Partitioning?
In contiguous memory allocation, one of the ways we allocate memory to the processes as they come into RAM is by using fixed-size partitioning, also known as static partitioning.
The idea behind fixed partitioning is that memory is divided into fixed-size partitions.
This is done by putting the operating system in the lowest memory location.
When processes enter the system, they are classified based on how much memory they require. Each class of process requires a Process Queue.
Once a process is selected to allocate memory, it is loaded into memory and competes for the processor.
The number of fixed partitions measures Multi-programming. Each queue has its memory region, so there is no competition for memory between them.
Whenever we start our system, the operating system gets loaded in the RAM, and then the remaining memory is used for allocating the processes to the CPU.
In the above diagram, the left side has the fixed partitioning of different sizes, and the right side has the fixed partitioning of equal sizes, i.e., 4MB.
Note: The process we will allocate should be less than or equal to the memory size. Because if we allocate the process greater than the fixed size, it will create internal fragmentation.
“Must Recommended Topic, Internal and External Fragmentation, Multiprogramming vs Multitasking“
How does fixed partitioning work?
Case1: Suppose a process P1 comes of size 2MB. We allocated it at position 0. Note that we can allocate it at any place. Still, its size should be less than the fixed partition in contiguous memory allocation; we cannot divide one process into different processes. So in this way, there will be no internal fragmentation(2MB-2MB=0MB).
Case 2: Suppose a process P2 comes of size 3MB. First, we will check where the space is available. If there is no process yet allocated in the memory, we allocate it to position 1; if not, wherever the space is available, we will allocate it there. So at position one, the available memory is 4MB, and the process is 3MB. Hence there will be an internal fragmentation(4MB-3MB=1MB).
Case 3: Suppose a process P3 comes of size 12MB.We can not allocate this process in the memory as it is larger than the fixed partitions. So there will be a limited process quantity.
Advantages
-
Easy to implement:
Implementing a division or partition is not a difficult task. Whether internal or external fragmentation occurs, it must process the specific partitions. -
Little OS overhead:
Fixed partitions require a relatively low amount of computing power.
Disadvantages
-
Internal Fragmentation:
Inefficient use of main memory. No matter how small the program, it occupies the entire partition. This increases the chances of internal fragmentation. -
Limited process size:
Typically, the main memory cannot accommodate larger processes than their partition size. It is impossible to resize the partition according to the size of incoming processes. -
Degree of multiprogramming:
The main memory is partitioned either before or during the system configuration process. A fixed number of partitions are set up in the main memory. The condition R<= P must be met if R partitions in RAM and P is the number of processes. There is an error if the number of processes in a particular partition exceeds the number of RAM partitions. -
External fragmentation:
Due to the limitations of spanning, the total unused space on different partitions cannot be used to load non-differentiated processes, even if the space is available.
You can also read about the interleave memory and Open Source Operating System.