What is the difference between deadlock detection, avoidance and prevention? When do we use which?
A set of processes are said to be in a deadlock when each process is holding some resources and is waiting for a resources held by some other process in the set.Deadlock detection is a technique to handle deadlocks which tries to find out if the system is in deadlock and then works to recover it from the deadlock if any exists. It is used as an afterthought and is not coordinated with the resource allocating procedures.Deadlock avoidance is a technique which works hand-in-hand with the resource allocation and tries to ensure that a resource request made in a non-deadlocked state is granted only if it will not lead to a deadlock in the future. This technique however makes unrealistic demands about the kind of information it needs from process, in that, it requires the entire pattern of resource requests, past & future.Deadlock prevention is a technique which influences the design of the resources allocator and their classification. It uses various techniques to ensure that at least one