You can use interlocks to protect a resource that is shared among several participating processes. Interlocks are used in much the same way as the availability state of an event. However, for interlocks, the LOCK and UNLOCK functions are used instead of PROCURE and LIBERATE statements. Interlocks provide the following advantages when compared to the use of events:
-
Interlock functions are executed more quickly than PROCURE and LIBERATE statements.
-
Unlike the PROCURE statement, the LOCK statement can include options causing the action to be abandoned if a specified event occurs or if a given time limit elapses.
Interlocks are available only in ALGOL and NEWP. The syntax for declaring and using interlocks is the same in both languages.
Interlocks can be in any of three different states: FREE, LOCKED_CONTENDED, or LOCKED_UNCONTENDED. Only one process can succeed in locking the interlock at a time. If multiple processes are waiting to lock the interlock, then when the current owner unlocks that interlock, the system allows one of the waiting processes to complete its lock; the other processes continue to wait.

