All Questions
Dealing With Contention hard

When is a Spinlock preferred over a Mutex?

  1. A When the Critical Section is very short (few instructions) and typically releases quickly. Context switching takes ~5-10 microseconds. If the lock is held for <1 microsecond, spinning saves the OS overhead.
  2. B When you have a single core.
  3. C When memory is low.
  4. D For DB transactions.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions