Deadlocks
- Deadlocks can occur on hardware resources or on software
resources.
Necessary conditions for a deadlock:
A dead lock situation can arise if the following conditions hold simultaneously in a system:
Mutual Exclusion - some resources must be used/ held in a non-sharable manner. A resource can be held by no more than one process at a time.
Hold and wait - process that is holding a resource and is waiting to acquire additional resources that are currently being held by other processes. Processes do not voluntarily release resources until finished.
No preemption - Resources cannot be preempted. Resource is only released by holding process. We don't take resources away from processes once they've been assigned.
Circular wait - A process wait on resources held by another waiting process. e.g. P1 waiting for R1 which is held by P2 which is waiting for R2 held by P1.