1

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?

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

This is a very good source if you are going to study Working Set model.

So If I summarize the points in simple way

  • Thrashing happens when the system spends all its time loading pages into the memory.
  • So it doesn't do any productive processing tasks, which means a waste of time.
  • The primary reason for Thrashing is the total amount of memory demanding by the processes (in total) exceeds the total actual memory by a great amount, so page faults occur frequently.
  • As a solution the working set model simply keeps only the working set of pages of each processes. It helps the memory to utilize the pages only which are needed at the moment (now and near future).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.