Computer science: a technique for avoiding conflicts if a resource is accessed concurrently. Can be used to enforce mutual exclusion.

An example: Say you have a file saved somewhere on a computer network. Two users A and B both open the file for editing at (roughly) the same time. After some time, A saves the modified file; some time later, B does the same.

In this case, whoever saves their work last will overwrite the previously saved version, wiping out those changes, so here A's changes will be lost. This is because B's editor program does not realize the file changed after it was read in initially.

One way to avoid problems like this is to have some mechanism to indicate that a resource is in use, that it is "locked"; this is called locking. Often a lock file is used to indicate this, but it can be anything which all those doing access respect.

The problem of avoiding or controlling concurrent access arises in all situations where concurrent access can happen, such as multiprocessor systems, multi-threaded programs or networks with several machines. The implementation of the lock (file, memory area, spinlock, semaphore...) differs, but the principle is the same.

A good example for the use of locking is the Unix editor vim: Open any file with vim, then go to a different terminal, start another vim and open the same file. You will get a warning dialogue. Vim uses lock files, by the way.

Locking is the first professional street dance. Don "Campbellock" Campbell invented lockin' in the late '60's when he was trying to do the funky chicken. He couldn't do it, but in the process he stumbled upon this style.

Locking is hard to explain without showing, but has many moves: Uncle Same points, knee drops, and playing with the hat, to name a few. (Also, within the style of locking, there is a move called locking.)

To many, locking is a way of life in which every gesture or facial expression one makes is exaggerated.

All information obtained from The Freshest Kids.

Log in or register to write something here or to contact authors.