Synchronisation

Threads that update shared data race unless a mutex or semaphore makes the update atomic, and taking locks in different orders can deadlock.

From Computer systems, a programmer's view.