Thrashing in Operating System (OS)

Thrashing in OS

Thrashing in OS

First we need to know what actually happens inside your OS that makes your system behave as if it has a very large memory. In operating systems that implement a virtual memory space, the programs  allocate memory from an address space that may be much larger than the  actual amount of RAM the system possesses. OS decides which program’s memory is actually in RAM at any specific instant of time.

Page Fault and Swapping

A page fault occurs when the memory access requested (from the virtual  address space) does not map to something that is in RAM. A page must  then be sent from RAM to swap, so that the requested new page can be  brought from swap to RAM. This results in 2 disk I/Os. Now you might know that disk I/Os are very slow as compared to memory access.


Now if it happens that your system has to swap pages at such a higher rate that major chunk of CPU time is spent in swapping then this state is known as thrashing. So effectively during thrashing, the CPU spends less time in some actual productive work and more time in swapping.

Cause of Thrashing

  1.  High degree of multiprogramming: -The CPU scheduler sees the decreasing CPU utilization and increases the degree of multiprogramming as a result. The new process tries to get started by taking frames from running processes, causing more page faults and a longer queue for the paging device. As a result, CPU utilization drops even further, and the CPU scheduler tries to increase the degree of multiprogramming even more
  2. Lack of frames:- If  a process has less number of frames then less pages of that process will be able to reside in memory and hence it would result in more frequent swaping. This may lead to thrashing. Hence sufficient amount of frames must be allocated .


  • Do not allow the system to go into thrashing by instructing the long term scheduler not to bring the processes into memory after the threshold.
  • If the system is already in thrashing then instruct the mid term schedular to suspend some of the processes so that we can recover the system from thrashing.
Review Date
Reviewed Item
Author Rating