Interlock (engineering)
An interlock is a feature that makes the state of two mechanisms or functions mutually dependent. It may consist of any electrical, or mechanical devices or systems. In most applications, an interlock is used to help prevent any damage to the machine or to the operator handling the machine. For example, elevators are equipped with an interlock that prevents the moving elevator from opening its doors and prevents the stationary elevator (with open doors) from moving. Interlocks may include sophisticated elements such as curtains of infrared beams, photodetectors, simple switches, and locks. It can also be a computer containing an interlocking computer program with digital or analogue electronics. Trapped-key interlocking
Trapped-key interlocking is a method of ensuring safety in industrial environments by forcing the operator through a predetermined sequence using a defined selection of keys, locks and switches. It is called trapped key as it works by releasing and trapping keys in a predetermined sequence. After the control or power has been isolated, a key is released that can be used to grant access to individual or multiple doors. Below is an example of what a trapped key interlock transfer block would look like. This is a part of a trapped key interlocking system. In order to obtain the  keys in this system, a key must be inserted and turned (like the key at the bottom of the system of the picture). Once the key is turned, the operator may retrieve the remaining keys that will be used to open other doors. Once all keys are returned, then the operator will be allowed to take out the original key from the beginning. The key will not turn unless the remaining keys are put back in its place. Another example is an electric kiln. To prevent access to the inside of an electric kiln, a trapped key system may be used to interlock a disconnecting switch and the kiln door. While the switch is turned on, the key is held by the interlock attached to the disconnecting switch. To open the kiln door, the switch is first opened, which releases the key. The key can then be used to unlock the kiln door. While the key is removed from the switch interlock, a plunger from the interlock mechanically prevents the switch from closing. Power cannot be re-applied to the kiln until the kiln door is locked, releasing the key, and the key is then returned to the disconnecting switch interlock. A similar two-part interlock system can be used anywhere it is necessary to ensure the energy supply to a machine is interrupted before the machine is entered for adjustment or maintenance. Mechanical

Interlocks may be strictly mechanical. An example of a mechanical interlock is a steering wheel of a car. In modern days, most cars have an anti-theft feature that restricts the turning of the steering wheel if the key is not inserted in the ignition. This prevents an individual from pushing the car since the mechanical interlock restricts the directional motion of the front wheels of the car. In the operation of a device such as a press or cutter that is hand fed or the workpiece hand removed, the use of two buttons to actuate the device, one for each hand, greatly reduces the possibility of operation endangering the operator. No such system is fool-proof, and such systems are often augmented by the use of cable–pulled gloves worn by the operator; these are retracted away from the danger area by the stroke of the machine. A major problem in engineering operator safety is the tendency of operators to ignore safety precautions or even outright disabling forced interlocks due to work pressure and other factors. Therefore, such safeties require and perhaps must facilitate operator cooperation. Electrical
Many people use generators to supplement power to a home or business in the event that main (municipal) power has gone offline. In order to safely transfer the power source from a generator (and back to the main), a safety interlock is often employed. The interlock consists of one or more switches that prevent both main power and generator power from powering the dwelling simultaneously. Without this safeguard, both power sources running at once could cause an overload condition, or generator power back-feed onto the main could cause the dangerous voltage to reach a lineman repairing the main feed far outside the building. An interlock device is designed to allow a generator to provide backup power in such a way that it (a) prevents main and generator power to be connected at the same time, and (b) allows circuit breakers to operate normally without interference in the event of an overload condition. Most interlock devices for electrical systems employ a mechanical device to manage the movement of circuit breakers. Some also allow for the use of padlocks to prevent someone from accidentally activating the main power system without authorization. Defeatable
Interlocks prevent injuries by preventing direct contact with energized parts of electrical equipment. Only a  qualified personnel, who must use a tool (such as a screwdriver) to bypass the interlock. Such interlocks are called defeatable interlocks, and are specified by Underwriters Laboratory (UL) standard UL508a, and National Electrical Code (NEC) Article 409.2. Defeatable interlocks are allowed with electrical equipment up to 600 Volts. Security

In high-security buildings, access control systems are sometimes set up so that ability to open one door requires another one to be closed first. Such setups are called a mantrap. Interlocks can be used as a high level entrance security. There are two kinds of interlocking systems for security. The first form of interlocking security is more mechanical. For example, if an individual is entering a building, there may be two sets of doors to enter from. As the individual enters the first door, that door will close before they enter through the second door. This type of interlocking security can prevent piggybacking or tailgating. The second form of interlocking security is electronic. This is in the form of detection and identification systems. Examples of such systems can be PIN codes, face recognition, and/or fingerprint recognition. Microprocessors
In microprocessor architecture, an interlock is digital electronic circuitry that stalls a pipeline (inserts bubbles) when a hazard is detected until the hazard is cleared. One example of a hazard is if a software program loads data from the system bus and calls for use of that data in the following cycle in a system in which loads take multiple cycles (a load-to-use hazard). An interlock may be used to prevent undesired states in a finite-state machine. See also

 Fail-safe
 Railway interlocking
 Breath alcohol ignition interlock device
 Safety instrumented system
 Piggybacking 
 Tailgating
 Lockout-tagout

References

Instruction processing
Safety switches