Meaning – The term lock, refers to the means by which integrity of datais ensured by preventing more than one user from accessing or changing the same data or object at the same time.
The term lock also refers to a password-protection system that can be used to prevent access to some advanced functions.
A lock is also a command found with some versions of Microsoft Windows that allowed a user to lock their drive.
Locks are typically advisory, which means that a thread works collaboratively with other threads to acquire the lock before it is given access to the data it queries. Mandatory locks are also applied by some systems, where an exception occurs as a result of unauthorized access to a source in a locked status.
Example of usage – “A lock has a simple form called a semaphore, where there is no solid difference between a shared, read-only mode and an exclusive read/write mode.”