Bird
Raised Fist0
Operating Systemsknowledge~20 mins

Thrashing and working set model in Operating Systems - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Memory Mastery: Thrashing & Working Set
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Thrashing in Operating Systems

What is the primary cause of thrashing in an operating system?

AThe system has too many processes competing for limited physical memory, causing excessive paging.
BThe system has too much free memory and is not using it efficiently.
CThe disk is malfunctioning and cannot read data properly.
DThe CPU is idle because there are no processes to execute.
Attempts:
2 left
💡 Hint

Think about what happens when memory is overused and the system spends more time swapping pages than executing processes.

📋 Factual
intermediate
2:00remaining
Working Set Model Definition

Which of the following best describes the working set model in operating systems?

AIt measures the CPU time used by a process to decide its priority.
BIt counts the total number of pages in the system regardless of process activity.
CIt tracks the set of pages a process has referenced in the last fixed number of page references to estimate its current memory needs.
DIt records the number of processes waiting in the ready queue.
Attempts:
2 left
💡 Hint

Consider how the model helps decide how much memory a process needs based on recent activity.

🔍 Analysis
advanced
2:00remaining
Analyzing Effects of Working Set Size

If a process's working set size suddenly increases beyond the available physical memory, what is the most likely immediate effect on system performance?

AThe CPU will switch to idle mode to save power.
BThe system will experience thrashing, leading to a significant slowdown.
CThe process will complete faster because it uses more memory.
DThe system will automatically increase physical memory to accommodate the process.
Attempts:
2 left
💡 Hint

Think about what happens when memory demand exceeds supply suddenly.

❓ Comparison
advanced
2:00remaining
Comparing Local and Global Page Replacement

How does the working set model influence the choice between local and global page replacement policies?

AThe working set model forces the system to use FIFO page replacement.
BThe working set model requires global replacement to share pages among all processes equally.
CThe working set model ignores page replacement policies entirely.
DThe working set model supports local replacement to keep a process's pages in memory, reducing thrashing.
Attempts:
2 left
💡 Hint

Consider how keeping a process's recent pages in memory affects performance.

❓ Reasoning
expert
2:00remaining
Predicting System Behavior with Working Set Changes

Consider a system using the working set model for memory management. If multiple processes simultaneously increase their working set sizes, what is the most likely system-wide consequence?

AThe system will likely enter thrashing, as total memory demand exceeds physical memory.
BThe system will pause all processes until memory is freed.
CThe CPU will allocate more time slices to each process to handle the increased memory needs.
DThe system will automatically reduce the working set sizes to prevent thrashing.
Attempts:
2 left
💡 Hint

Think about what happens when many processes need more memory than the system has.

Practice

(1/5)
1. What is thrashing in operating systems?
easy
A. A system running multiple programs efficiently
B. A process running without any memory
C. A method to speed up CPU processing
D. Excessive paging causing slow system performance

Solution

  1. 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.
  2. Step 2: Identify the effect of thrashing

    This excessive paging slows down the computer significantly, reducing performance.
  3. Final Answer:

    Excessive paging causing slow system performance -> Option D
  4. Quick Check:

    Thrashing = Excessive paging slowing system [OK]
Hint: Thrashing means too much swapping slows the computer [OK]
Common Mistakes:
  • Confusing thrashing with normal multitasking
  • Thinking thrashing speeds up the CPU
  • Believing thrashing means no memory usage
2. Which of the following best describes the working set of a process?
easy
A. Pages never accessed by the process
B. All pages in the system memory
C. Pages recently used by the process
D. Pages swapped out to disk

Solution

  1. Step 1: Define working set

    The working set is the collection of pages a process has used recently and needs to run efficiently.
  2. Step 2: Identify correct description

    Pages recently used by the process fit this definition, unlike all pages or swapped pages.
  3. Final Answer:

    Pages recently used by the process -> Option C
  4. Quick Check:

    Working set = Recently used pages [OK]
Hint: Working set means pages used recently by process [OK]
Common Mistakes:
  • Thinking working set includes all system pages
  • Confusing working set with swapped out pages
  • Assuming working set is pages never accessed
3. Consider a system where a process's working set size suddenly grows beyond available memory. What is the most likely outcome?
medium
A. Thrashing will occur, slowing down the system
B. The process will run faster due to more pages
C. The system will ignore the extra pages
D. The process will terminate immediately

Solution

  1. Step 1: Analyze working set growth impact

    If the working set grows beyond available memory, the system must swap pages frequently to keep up.
  2. Step 2: Identify system behavior

    This frequent swapping causes thrashing, which slows down the system instead of speeding it up.
  3. Final Answer:

    Thrashing will occur, slowing down the system -> Option A
  4. Quick Check:

    Working set too big = Thrashing slows system [OK]
Hint: Too big working set causes thrashing and slowdown [OK]
Common Mistakes:
  • Assuming more pages always improve speed
  • Believing system ignores memory limits
  • Thinking process ends immediately without warning
4. A system is experiencing thrashing. Which change would best reduce thrashing?
medium
A. Increase the working set size of all processes
B. Reduce the number of processes competing for memory
C. Decrease the CPU speed
D. Disable paging completely

Solution

  1. Step 1: Understand cause of thrashing

    Thrashing happens when too many processes compete for limited memory, causing excessive paging.
  2. Step 2: Identify best solution

    Reducing the number of processes competing for memory lowers paging demand and reduces thrashing.
  3. Final Answer:

    Reduce the number of processes competing for memory -> Option B
  4. Quick Check:

    Less competition = less thrashing [OK]
Hint: Fewer processes competing reduces thrashing [OK]
Common Mistakes:
  • Increasing working set size worsens thrashing
  • Decreasing CPU speed does not fix memory issues
  • Disabling paging causes system failure
5. A system uses the working set model to manage memory. If a process's working set is 100 pages but only 80 pages fit in memory, what should the system do to avoid thrashing?
hard
A. Swap out some pages from the process's working set
B. Increase the process's working set size to 120 pages
C. Allow the process to run with only 80 pages and swap frequently
D. Terminate the process immediately

Solution

  1. 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.
  2. 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.
  3. Final Answer:

    Swap out some pages from the process's working set -> Option A
  4. Quick Check:

    Adjust working set to fit memory to avoid thrashing [OK]
Hint: Adjust working set size to fit memory to prevent thrashing [OK]
Common Mistakes:
  • Increasing working set size worsens thrashing
  • Allowing frequent swaps causes thrashing
  • Terminating process is last resort, not first
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard