0
0
Operating Systemsknowledge~3 mins

Why Thrashing and working set model in Operating Systems? - Purpose & Use Cases

Choose your learning style9 modes available
The Big Idea

What if your computer could magically know exactly what it needs to keep ready to avoid slowing down?

The Scenario

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.

The Problem

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 Solution

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.

Before vs After
Before
if (memory_full) { swap_any_page(); }
After
if (working_set_exceeds_limit) { swap_least_used_page(); }
What It Enables

This concept enables computers to run programs smoothly without wasting time swapping memory pages back and forth.

Real Life Example

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.

Key Takeaways

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.