These are areas of code which can only be accessed by a single thread at any one time. Mutual Exclusions mutexes are objects that ensure that only a single thread has access to a protected variable or code at any one time. Semaphores These are similar to mutual exclusions but may include counters allowing only a specified number of threads access to a protected variable or code at any one time. This mechanism ensures that an non decomposable transaction is completed by a thread before access to the same atomic operation is granted to another thread. The thread may have non-interruptable access to the CPU until the operation is completed.
Mutual exclusion prevents two threads accessing the same resource simultaneously.
Deadlock avoidance can include initiation denial or allocation denial, both of which serve to eliminate the state required for deadlock before it arises. Both Linux and Windows NT solve these problems in different ways. Windows NT has functions which equate to all of the above instances. Both implement multiprocessor mutual exclusion mechanisms called spin locks which effectively stall the processor until a lock is achieved for a critical section.