- Thrashing degrades the performance of system.
- There can be a situation when memory is full of pages that are accesssed frequently. A page fault will occur if the required page is not present.
- In order to make space for swapping in the required page, one of the frequently accessed page is swapped out from main
- Soon the page is swapped out is required for execution and this again results in page fault.
- Thus a series of page fault occur and swapping becomes a large overhead.
- Thrashing generally occurs in multitasking os. As there are several processes running at same time, so memory becomes overcommitted so it leads to thrashing.
- When a global page replacement algo is used then it replaces pages with no regard to process to which they belong.
- After increasing the degree of multiprogramming, if a particular process enter a new phase, it may need more frames.
- Under these circumstances, this process starts faulting and takes away frames from other processes.
- These processes need those pages, however and so they also fault and take frames from other processes.
- All these faulting processes then queues up for the paging device to swap pages in and out. As processes wait for paging device, cpu utilization decreases.
- When cpu scheduler sees the decrease in cpu utilization, it increases the degree of multiprogramming. Thus new processes enter the system and take the frames from running processes. This results in more page faults and longer queue for paging
- As a result, cpu utilization drops even further and thrashing sets in.
- The os attempts to recover from thrashing by suspending the execution of current processes and preventing the execution of new process to start.
- Thrashing can be removed by selecting an appropriate page replacement algo.
- Thrashing can be avoided by using local page replacement algo. With local replcement, the process cannot take frames from another process. It just selects and swaps the page which belongs to the same process.
- Thrashing can also be prevented by allocating a process as many frames as it needs.
(Visited 62 times, 1 visits today)
Written by: 20/08/2018