Dealing With Contention easy
What is 'Starvation' in concurrency?
- A When the server has no power.
- B When a thread is perpetually denied access to necessary resources because other threads (e.g., higher priority ones) are constantly monopolizing them.
- C When the cache is empty.
- D When the database is deleted.
Answer: B. When a thread is perpetually denied access to necessary resources because other threads (e.g., higher priority ones) are constantly monopolizing them.
The thread is technically 'ready' to run but never gets the CPU/Lock. Fairness algorithms (FIFO) solve this.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- Why is 'Exponential Backoff' preferred over constant intervals for retries?
- What is the primary purpose of a Mutex (Mutual Exclusion) lock?
- Why does adding more threads sometimes *decrease* performance?
- In a Saga, if a Compensating Transaction (Undo) fails repeatedly due to contention, what is the last resort?
- In a database, what happens if Transaction A locks a row and Transaction B tries to modify the same row?
- A database restart causes thousands of application servers to instantly try to reconnect. This crashes the DB again. This is called: