All challenges
Multiple ChoiceHard 45s

Optimistic vs pessimistic locking

When is optimistic concurrency control (version/compare-and-swap) preferable to pessimistic locking?
Options
  1. 1When contention is very high and failures are costly, so blocking is cheaper than repeated retries
  2. 2When the transaction must hold a lock for several minutes, so version checks would expire first
  3. 3When you need strict serializability with absolutely no retries, which version checks cannot offer
  4. 4When conflicts are rare, so avoiding lock overhead and blocking is a net win with occasional retries

Think you can answer under pressure?

Get matched and answer live questions in 3-minute 1v1 battles. Elo ranking, badge tiers and bragging rights on the line.

Play this in a 3-minute battle