IT lexicon › Programming › Range locking

Range locking

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

The mechanism for locking a byte range within a file, not the entire file.

Advisory locks on Unix can be exclusive or shared, but typically lock an entire file. Range locking lets two processes write to different regions of the same file simultaneously. One process can say "lock bytes 1000–2000 exclusively" while another locks bytes 5000–6000. If a process tries to write to a locked range, it blocks. fcntl() is the POSIX mechanism. Windows has the same concept via LockFile. Databases use this frequently for concurrent updates.

← Back to the lexicon