Lock contention
A situation where multiple threads compete for the same lock, causing performance degradation.
Lock contention occurs when many threads need the same critical section simultaneously. One thread holds the lock; the rest queue up and wait. The longer the critical section, the more threads, and the less real work—the worse the contention. In extreme cases, a program can actually slow down with more threads than with fewer, as CPUs spend all time context-switching and lock management rather than working.
Solutions: shorten the critical section, split one slow lock into many smaller locks (lock striping), use lock-free structures, or dedicate a single thread to the work and communicate results asynchronously. Libraries like Google Abseil and others are entirely focused on minimizing lock contention in high-performance code.