Deadlocks occur when two or more processes are waiting for resources held by each other, resulting in none of the processes making progress. There are four conditions required for deadlock: mutual exclusion, hold and wait, no preemption, and circular wait. Techniques to prevent deadlocks include attacking each of these conditions, such as not allowing simultaneous access to resources, having processes request all resources up front before starting, allowing preemption of resources, and imposing a global numbering system on resource requests.