Bird
Raised Fist0

If a system uses a naive lock acquisition strategy that causes livelock under high contention, what is the best follow-up improvement to prevent livelock without sacrificing throughput?

hard🎤 Interviewer Follow-up Q10 of Q15
Operating Systems - Starvation vs Deadlock vs Livelock - Differences & Examples
If a system uses a naive lock acquisition strategy that causes livelock under high contention, what is the best follow-up improvement to prevent livelock without sacrificing throughput?
ARemove locks and use busy-waiting instead.
BIncrease lock granularity to reduce contention.
CIntroduce randomized backoff delays before retrying lock acquisition.
DUse strict priority scheduling to favor certain threads.
Step-by-Step Solution
Solution:
  1. Step 1: Understand livelock cause

    Livelock occurs when threads repeatedly retry locks simultaneously, preventing progress.
  2. Step 2: Evaluate improvements

    Introduce randomized backoff delays before retrying lock acquisition.: Randomized backoff reduces simultaneous retries, preventing livelock.
    Increase lock granularity to reduce contention.: Increasing lock granularity may reduce contention but not prevent livelock.
    Remove locks and use busy-waiting instead.: Busy-waiting wastes CPU and can worsen livelock.
    Use strict priority scheduling to favor certain threads.: Strict priority scheduling may cause starvation, not livelock prevention.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Random backoff breaks livelock cycles [OK]
Quick Trick: Random backoff breaks livelock cycles [OK]
Common Mistakes:
MISTAKES
  • Assuming busy-waiting helps
  • Thinking priority scheduling fixes livelock
  • Ignoring backoff strategies
Trap Explanation:
PITFALL
  • Candidates often overlook randomized backoff as a livelock solution, mistakenly favoring priority or busy-waiting.
Interviewer Note:
CONTEXT
  • Tests deep understanding of livelock mitigation techniques.
Master "Starvation vs Deadlock vs Livelock - Differences & Examples" in Operating Systems

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Operating Systems Quizzes