Concurrency in an LLD round
medium 40 minSooner or later the interviewer asks what happens when two users do it at the same time.
Watch lesson5:07
What each level should show
The same question is judged differently for mid, senior and staff.
Junior
Must show
- Sees the lost update in
count += 1 - Uses one lock correctly, on all paths
Will be probed on
- What if it throws inside?
- Is reading safe?
Stands out
Shows the unlucky order without being asked.
- Sees the lost update in
Mid
Must show
- Names the kind and the rule
- Puts the guard into the owner
- Finds the gap between two safe calls
Will be probed on
- Concurrent map
- Waiting without polling
Stands out
Says what is already safe and why.
Senior
Must show
- Keeps slow work outside the lock
- Chooses granularity with a reason
- Knows where the process ends
Will be probed on
- Two locks
- Timeouts and refusals
- Testing
Stands out
Gives the price, and the measurement that would change the choice.
Staff
Must show
- Removes sharing by design
- Writes down guard rules so that others keep them
- Plans how to find races in running code
Will be probed on
- Overload
- Ownership across teams
Stands out
Makes the unsafe use impossible to write.
How the levels differ in the rest of the round is on junior, mid and senior answers.