Dealing With Contention easy
What does it mean for an operation to be 'Atomic'?
- A It is very small.
- B It runs on a nuclear power plant.
- C It executes completely or not at all, and cannot be interrupted or seen in a partial state by other threads.
- D It is written in Assembly.
Answer: C. It executes completely or not at all, and cannot be interrupted or seen in a partial state by other threads.
Atomicity guarantees consistency. You never see a 'half-written' user record.
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: