Looking for something else?
A lock is a mechanism for controlling access to something. In programming, locks are often used so that multiple programs or threads of a program can share a resource - for example, access to a file for updating it - on a one-at-a-time basis. Typically, a lock is of temporary duration and when the resource is no longer required, it is freed for locking and use by the next sharer in a queue.
From a system point-of-view, locking is a method of synchronizing potentially concurrent uses of a database or other common resource. An operating system may enforce locking or some other mechanism in order to ensure that actions occur in the right sequence (when they don't, the situtation is known as a race condition). An operating system must also provide for means to ensure that two programs do not become dependent on each other for the release of a lock, a situation known as a deadlock in which the programs are essentially halted. In some systems, a mutex is a named object that provides a lock for a given resource.
'lock' is part of the:
View All Definitions