Method 1 : Allocating at least a minimum number of frames. Obviously, as the number of frames allocated to each process decreases, the page-fault rate increases, slowing process execution.
Method 2 : The easiest way to split m frames among n processes is to give everyone an equal share, m/n frames. For instance, if there are 93 frames and five processes, each process will get 18 frames. The three leftover frames can be used as a free-frame buffer pool. This scheme is called Equal Allocation.
Method 3 : If a small student process of 10 KB and an interactive database of 127 KB are the only two processes running in a system with 62 free frames, it does not make much sense to give each process 31 frames. The student process does not need more than 10 frames, so the other 21 are, strictly speaking, wasted. To solve this problem, we can use Proportional Allocation in which we allocate available memory to each process according to its size.
Q. Example of Proportional Allocation
Let the size of the virtual memory for process pi be si.
Let S be sum of all si
Then, if the total number of available frames is "m", we allocate "ai" frames to process pi, where ai is approximately : ai = ( si / S ) * m
With proportional allocation, we would split 62 frames between two processes, one of 10 pages and one of 127 pages, by allocating 4 frames and 57 frames, respectively, since 10/137 x 62 ~ 4, and 127/137 X 62 ~ 57. In this way, both processes share the available frames according to their "needs," rather than equally.
If the number of frames allocated to a low-priority process falls below the minimum number required by the computer architecture, we must suspend that process's execution.
We should then page out its remaining pages, freeing all its allocated frames. This provision introduces a swap-in, swap-out level of intermediate CPU scheduling.
If the process does not have the number of frames it needs to support pages in active use, it will quickly page-fault.
At this point, it must replace some page. However, since all its pages are in active use, it must replace a page that will be needed again right away. Consequently, it quickly faults again, and again, and again, replacing pages that it must back in immediately.
This high paging activity is called "Thrashing". A process is thrashing if it is spending more time paging than executing.