SpinTheMic
Pro

Interview practice question

Lock contention slows the service

Backend Engineering · Concurrency · Intermediate

Profiling shows threads spend most of their time waiting on a single lock protecting a shared map. How do you improve it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Coarse lock = contention.
  • Use concurrent map (striped locking).
  • Reduce work inside lock.
  • Read-write lock for read-heavy.
  • Shard data or use per-thread state.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics