A set of processes is in deadlock state if each of them waits for an event that can be caused only by process in the set.
Deadlock occurs when circuit is completed, if each resource has only one instance. Multi threaded programs are good candidate for deadlock because multiple thread can compete for shared resources.
Necessary conditions for deadlock :
Coffman identified four necessary conditions that must hold simultaneously for a deadlock to occur.
1. Mutual Exclusion: At least one resource must be held in non-sharable mode. only one process at a time can use the resource. if another process requests that resource the requesting process must be delayed until the resource has been released.
2. Hold and Wait: A process must be holding at least one resource and waiting to acquire additional resources that are currently being held by other process.
3. No preemption: Resource can not be preempted. A process can not use the resource forcefully which is acquired by other processes.
4. Circular wait: A circular chain of hold and wait condition exists in the system.
0 Comments