Allocation of Frames in OS [Operating System]

The main memory in the operating system is divided into frames. These frames store the process and once the process is stored as a frame the CPU can execute the process. Therefore the operating system has to allocate a sufficient number of frames for each corresponding process. Therefore there exist various algorithms that are used by the operating system in order to allocate the frame. There are mainly five ways to allocate the frame.

Equal frame allocation

As the name suggests the process will be allocated equally among all the available processes in the operating system. There is a disadvantage in equal frame allocation, for example, there is a process that requires more frames for allocation for execution and there are only a set number of frames that are present for allocation that will allocate an insufficient number of frames for the process execution. And the same can happen if the process requires less frame than the fixed set of frames for allocation. Let’s say the main memory has 40 frames for allocation and the first process requires only 10 frames and the next process requires 30 frames for execution. In this case, the first process will waste 10 frames in the allocation and the next process will have insufficient 10 frames for allocation. This problem was solved by the proportional frame allocation.

Proportional frame allocation

The equal frame has two drawbacks that either it will waste the frames or it may have an insufficient number of frames. The proportional frame allocation will allocate the frame on the basis of the size that is required for execution and the total number of the frames that the main memory has. The proportional frame allocation will allocate frames based on the size of the frame. But the disadvantage in the proportional frame allocation is that there is no priority in the allocation of the frame and it will allocate the frame based on the size the problem is solved by priority frame allocation.

Priority frame allocation

In the proportional frame allocation, the frames were allocated on the basis of size. But in the priority frame allocation, the process will be allocated on basis of the priority of the process and the number of frame allocation. If the process is of high priority and has more number of frames the process will be allotted that many frames in the main memory and the process with low priority will be allocated next. The frame allocation can occur based on both priority and the size of the frames required by the process.

Global replacement allocation

To understand the global replacement allocation you have to know what is paging in the operating system. When the operating system is executing programs then it will require pages which contains the memory required for allocation, some pages are stored in the primary memory of the operating system which is required for operation but when the operating system does not find the required frames in pages then it causes a page fault and calls for the pages from the secondary memory and that is the page replacement. The global replacement allocation takes care of the frame that is being allocated in pages. The global replacement algorithm tells us that the process having a low priority can give frames to the process with higher priority so that fewer number of page faults occur.

Local replacement allocation

As the global replacement allocation tells us that the frames can be stored in any priority process the local replacement allocation tells us that the frames of the pages will be stored on the same page, unlike global. This also does not influence the behavior of the process behavior as it did in the global replacement allocation.

Leave a Comment