What if your computer could magically know exactly what it needs to keep ready to avoid slowing down?
Why Thrashing and working set model in Operating Systems? - Purpose & Use Cases
Imagine you are trying to work on many tasks at once, but your desk is too small to hold all your papers. You keep shuffling papers in and out, losing track and slowing down your work.
Without a good way to manage which papers you keep on your desk, you waste time constantly swapping them. This makes your work slow and frustrating, and you often repeat tasks because you lost important papers.
The working set model helps by keeping only the most needed papers on your desk, so you don't waste time swapping. It tracks what you used recently and keeps that ready, preventing thrashing--when you spend all your time swapping and no time working.
if (memory_full) { swap_any_page(); }if (working_set_exceeds_limit) { swap_least_used_page(); }This concept enables computers to run programs smoothly without wasting time swapping memory pages back and forth.
When you open many apps on your phone, the working set model helps keep only the apps you use most active, so your phone doesn't slow down by constantly switching between all apps.
Thrashing happens when too much swapping slows down the system.
The working set model tracks recent memory use to keep important data ready.
This improves performance by reducing unnecessary swapping.
Practice
thrashing in operating systems?Solution
Step 1: Understand the meaning of thrashing
Thrashing happens when the system spends too much time swapping pages in and out of memory instead of executing processes.Step 2: Identify the effect of thrashing
This excessive paging slows down the computer significantly, reducing performance.Final Answer:
Excessive paging causing slow system performance -> Option DQuick Check:
Thrashing = Excessive paging slowing system [OK]
- Confusing thrashing with normal multitasking
- Thinking thrashing speeds up the CPU
- Believing thrashing means no memory usage
working set of a process?Solution
Step 1: Define working set
The working set is the collection of pages a process has used recently and needs to run efficiently.Step 2: Identify correct description
Pages recently used by the process fit this definition, unlike all pages or swapped pages.Final Answer:
Pages recently used by the process -> Option CQuick Check:
Working set = Recently used pages [OK]
- Thinking working set includes all system pages
- Confusing working set with swapped out pages
- Assuming working set is pages never accessed
Solution
Step 1: Analyze working set growth impact
If the working set grows beyond available memory, the system must swap pages frequently to keep up.Step 2: Identify system behavior
This frequent swapping causes thrashing, which slows down the system instead of speeding it up.Final Answer:
Thrashing will occur, slowing down the system -> Option AQuick Check:
Working set too big = Thrashing slows system [OK]
- Assuming more pages always improve speed
- Believing system ignores memory limits
- Thinking process ends immediately without warning
Solution
Step 1: Understand cause of thrashing
Thrashing happens when too many processes compete for limited memory, causing excessive paging.Step 2: Identify best solution
Reducing the number of processes competing for memory lowers paging demand and reduces thrashing.Final Answer:
Reduce the number of processes competing for memory -> Option BQuick Check:
Less competition = less thrashing [OK]
- Increasing working set size worsens thrashing
- Decreasing CPU speed does not fix memory issues
- Disabling paging causes system failure
Solution
Step 1: Analyze working set vs memory size
The process needs 100 pages to run well, but only 80 pages fit in memory, causing potential thrashing.Step 2: Determine best memory management action
Swapping out some pages from the working set or adjusting memory allocation helps keep the working set within limits and avoids thrashing.Final Answer:
Swap out some pages from the process's working set -> Option AQuick Check:
Adjust working set to fit memory to avoid thrashing [OK]
- Increasing working set size worsens thrashing
- Allowing frequent swaps causes thrashing
- Terminating process is last resort, not first
Ready to prove it?
Pass the test and this pattern moves unknown
