Is Lock-Free Faster?

Someone proposes rewriting a contended queue as a lock-free structure for performance. How do you respond?

The scenario

A team wants to replace a std::mutex-guarded work queue with a hand-written lock-free MPMC queue. The profile shows 4% of wall time in queue operations and 61% in a downstream JSON serializer.

What it tests

  • Whether the candidate knows lock-free is a progress guarantee, not a speed claim
  • Whether they can name the specific costs: CAS retries, ABA, memory reclamation
  • Whether they ask for a measurement and a reason before agreeing

Answer it out loud first. Recognising a good answer is not the same skill as producing one.