1 / 12

The ‘deadlock’ conditions

The ‘deadlock’ conditions. Reviewing some key points concerning the potential for ‘deadlock’ in an operating system. What is ‘deadlock’?. The blocking of a set of processes that are competing for certain system resources or that are communicating with one another

sfrance
Download Presentation

The ‘deadlock’ conditions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The ‘deadlock’ conditions Reviewing some key points concerning the potential for ‘deadlock’ in an operating system

  2. What is ‘deadlock’? • The blocking of a set of processes that are competing for certain system resources or that are communicating with one another • The blocking is permanent unless the OS takes some extraordinary action, such as killing one or more processes or forcing one or more processes to backtrack • William Stallings (see chapter 6 summary)

  3. Four required conditions • Mutual exclusion • Hold and Wait • No Preemption • Circular wait

  4. Mutual Exclusion • A particular resource may be used by only one process at a time • If a process has acquired the right to use a particular resource, then no other process may acquire the right to use that resource until it has been released by its owner

  5. Hold and Wait • When a process acquires the right to use a resource, it may attempt to acquire the right to use another resource, and while waiting for permission to use the second resource, it may hold onto its right to use the first resource

  6. No preemption • Once a process has been granted the right to use a particular resource, this right can not be involuntarily taken away, but will be held until explicitly released by its owner

  7. Circular wait • There exists a closed chain of processes in which each process of the chain holds some resource that is needed by the next process in this chain

  8. Dealing with ‘deadlock’ • Three general approaches: • Prevention • Detection • Avoidance

  9. Prevention • Guarantee that deadlock cannot occur, by insuring that one or more of the necessary conditions for deadlock will not be met

  10. Detection • Needed if the OS always follows a policy of granting requests for resources • Periodically the OS needs to check for an occurrence of a circular wait, and if found, take some action to break the deadlock

  11. Avoidance • The OS can analyze each new request for resources to see if granting it could lead to a deadlock, and then denying the request if it could potentially result in a deadlock • The Banker’s Algorithm is an example of this approach

  12. Important rule-of-thumb • You can avoid ‘circular waits’ by following a fixed order when requesting resources (in cases where a process needs multiple resources), and release these resources (in the reverse order) if they cannot all be immediately acquired

More Related