Comments on Deadlock
In practice, deadlocks can arise when waiting for some reusable resources. For example, an operating system may be handling several executing jobs, none of which has enough room to finish (and free up memory for the others)
Operating systems may detect/avoid deadlocks by:
- checking continuously on requests for resources
- refusing to allocate resources if allocation would lead to a deadlock
- terminating a process that is responsible for deadlock
One can have a process that sits and watches, and can break a deadlock if necessary. This process may be invoked:
- on a timed interrupt basis
- when a process wants to queue for a resource
- when deadlock is suspected (i.e.: CPU utilization has dropped to 0)