When a page fault occurs, there is a free frame available to store a new page into a frame. While the page swap is taking place, a replacement can be selected, which is written to the disk as the user process continues to execute. The operating system allocates all its buffer and tablespace from the free-frame list for the new page.
Two major allocation Algorithm/schemes.
Equal allocation: The easiest way to split m frames among n processes is to give everyone an equal share, m/n frames. This is known as equal allocation.
proportional allocation: Here, it allocates available memory to each process according to its size. Let the size of the virtual memory for process pi be si, and define S= ∑ 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 x m.
Global Versus Local Allocation
We can classify page-replacement algorithms into two broad categories: global replacement and local replacement.
Global replacement allows a process to select a replacement frame from the set of all frames, even if that frame is currently allocated to some other process; one process can take a frame from another.
Local replacement requires that each process selects from only its own set of allocated frames.
The system spends most of its time shuttling pages between main memory and secondary memory due to frequent page faults. This behavior is known as thrashing.
A process is thrashing if it is spending more time paging than executing. This leads to:
low CPU utilization and the operating system thinks that it needs to increase the degree of multiprogramming.