Reputation: 139
I am confused about thrashing. Let's say we have a set of pages: 2 4 6 8 2 5 8 and working set size= 4. Are we supposed to move until the end of page size and then sum all working set sizes up then compare with the memory size and decide if thrashing occurs or not? For example, in this set in the first interval WS(t1)={2,4,6,8}, WS(t2)={4,6,8,2}, WS(t3)= {6,8,2,5}, and WS(t4)={8,2,5}. So when we add working set sizes sum= 15. Am I going to compare this value with the memory size and decide if thrashing occurs?
Upvotes: 1
Views: 959
Reputation: 12948
This is a very good source if you are going to study Working Set model.
So If I summarize the points in simple way
Upvotes: 1
Reputation: 14886
I don't think you understand what thrashing is. When you have many page faults, the CPU utilization will drop, as you spend time moving frames into and out of RAM. The OS will think that the degree of multiprogramming is low, so it will start a new processes which also need frames in memory. This in turn, decreases the number of frames processes had, which might cause them to thrash too. Hence, increasing the problem. Instead of fixing it.
What you aim in Working-Set-Model is to estimate the number of pages you are going to access in the near future and maintain them in memory so that you don't have page faults.
Now, if we want to keep page faults number low, we need the heavily accessed pages by process to be in RAM, they are its working set.
If for all process you sum the number of pages, then multiply by page size, that is how much memory you need to keep number of page faults low. If this number exceeds free memory, page faults will occur and might lead to thrashing
Upvotes: 2