IT lexicon › Programming › Critical region

Critical region

Programming På svenska → Updated: 2026-11-15

A code section whose access must be restricted so that only one thread at a time executes the code.

A critical region protects invariants by ensuring threads don't read or write half-finished data simultaneously. Protection can be implemented with mutexes (locking), monitor objects, or lock-free atomic operations. The smaller and less frequently a critical region executes, the less lock contention occurs. A well-designed parallel application minimizes both the size and duration of critical regions—too much locking becomes the bottleneck, and too little is buggy.

← Back to the lexicon