Write a note on deadlocks.
The proper definition of deadlock
A set of processes is deadlocked if every process in the set is waiting for an event that only a process in the set can cause.
There are four essential conditions for deadlock to occur. They are as follows:
- Mutual Exclusion: Resources are not      sharable. 
- Non-preemption: formerly a resource is      given to a process it can't be revoked until the process voluntarily gives      it up. 
- Hold and Wait: It is probable for a      process that is holding resources to request more. 
- Circular wait: It is probable for      there to be a cyclic pattern of requests. 
The techniques used by OS for handling deadlock are:
- Deadlock      detection and recovery: Permit      the system to enter a deadlock state, detect it and then recover.
- Deadlock      prevention: Use      a protocol to make sure that the system will never enter a dead lock      state.           
      3.   Deadlock avoidance: Evade deadlock by careful resource scheduling.