Thrashing in Operating System:
Definition and Explanation:
The virtual memory model gives the opportunity for the system to sustain an indefinite number of processes simultaneously. If too many processes are running, their resident-in-real-memory pages will be very restrictive. It will cause frequent occurrence of page, faults. At some time, the processor may be spending the most of its time swapping pages and doing little productive work. This condition is known as thrashing.
Thrashing is caused by under allocation of the minimum number of pages required by a process, forcing it to continuously page fault. The system can detect thrashing by evaluating the level of CPU utilization as compared to the level of multiprogramming. It can be eliminated by reducing the level of multiprogramming.
The below graph shows CPU utilization rate with the number of active processes:
From the above we see that the operating system must regulate the number of active processes to prevent the onset of thrashing.