Home » Allocation of Frames in OS

Allocation of Frames in OS

by Online Tutorials Library

Allocation of Frames in OS

The main memory of the operating system is divided into various frames. The process is stored in these frames, and once the process is saved as a frame, the CPU may run it. As a result, the operating system must set aside enough frames for each process. As a result, the operating system uses various algorithms in order to assign the frame.

Demand paging is used to implement virtual memory, an essential operating system feature. It requires the development of a page replacement mechanism and a frame allocation system. If you have multiple processes, the frame allocation techniques are utilized to define how many frames to allot to each one. A number of factors constrain the strategies for allocating frames:

  1. You cannot assign more frames than the total number of frames available.
  2. A specific number of frames should be assigned to each process. This limitation is due to two factors. The first is that when the number of frames assigned drops, the page fault ratio grows, decreasing the process’s execution performance. Second, there should be sufficient frames to hold all the multiple pages that any instruction may reference.

There are mainly five ways of frame allocation algorithms in the OS. These are as follows:

  1. Equal Frame Allocation
  2. Proportional Frame Allocation
  3. Priority Frame Allocation
  4. Global Replacement Allocation
  5. Local Replacement Allocation

Equal Frame Allocation

In equal frame allocation, the processes are assigned equally among the processes in the OS. For example, if the system has 30 frames and 7 processes, each process will get 4 frames. The 2 frames that are not assigned to any system process may be used as a free-frame buffer pool in the system.

Disadvantage

In a system with processes of varying sizes, assigning equal frames to each process makes little sense. Many allotted empty frames will be wasted if many frames are assigned to a small task.

Proportional Frame Allocation

The proportional frame allocation technique assigns frames based on the size needed for execution and the total number of frames in memory.

The allocated frames for a process pi of size si are ai = (si/S)*m, in which S represents the total of all process sizes, and m represents the number of frames in the system.

Disadvantage

The only drawback of this algorithm is that it doesn’t allocate frames based on priority. Priority frame allocation solves this problem.

Priority Frame Allocation

Priority frame allocation assigns frames based on the number of frame allocations and the processes. Suppose a process has a high priority and requires more frames that many frames will be allocated to it. Following that, lesser priority processes are allocated.

Global Replacement Allocation

When a process requires a page that isn’t currently in memory, it may put it in and select a frame from the all frames sets, even if another process is already utilizing that frame. In other words, one process may take a frame from another.

Advantages

Process performance is not hampered, resulting in higher system throughput.

Disadvantages

The process itself may not solely control the page fault ratio of a process. The paging behavior of other processes also influences the number of pages in memory for a process.

Local Replacement Allocation

When a process requires a page that isn’t already in memory, it can bring it in and assign it a frame from its set of allocated frames.

Advantages

The paging behavior of a specific process has an effect on the pages in memory and the page fault ratio.

Disadvantages

A low priority process may obstruct a high priority process by refusing to share its frames.

Global Vs. Local Replacement Allocation

The number of frames assigned to a process does not change using a local replacement strategy. On the other hand, using global replacement, a process can choose only frames granted to other processes and enhance the number of frames allocated.


You may also like