lecture15-chapter06 - Operating Systems Operating Lecture...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Operating Systems Operating Systems Lecture 15: Lecture 15: Deadlock and Starvation Deadlock and Starvation Anda Iamnitchi [email protected] 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 Four Conditions for Four Conditions for Deadlock Deadlock 1. Mutual exclusion condition Only one process may use a resource at a time 1. Hold-and-wait condition A process may hold allocated resources while awaiting assignment of others 1. No preemption condition No resource can be forcibly removed form a process holding it 1. Circular wait condition A closed chain of processes exists, such that each process holds at least one resource needed by the next process in the chain
Background image of page 2
Dealing with Deadlock Dealing with Deadlock Three general approaches exist for dealing with deadlock. Prevent deadlock Avoid deadlock Detect Deadlock (and there is a 4 th approach: The Ostrich Algorithm)
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Deadlock Prevention Deadlock Prevention
Background image of page 4
5 Idea: invalidate one of the Idea: invalidate one of the four conditions for four conditions for deadlock deadlock 1. Mutual exclusion condition 2. Hold-and-wait condition 3. No preemption condition 4. Circular wait condition
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
6 Attacking the Mutual Exclusion Attacking the Mutual Exclusion Condition Condition Some devices (such as printer) can be spooled only the printer daemon uses printer resource thus deadlock for printer eliminated Not all devices can be spooled Principle: avoid assigning resource when not absolutely necessary as few processes as possible actually claim the resource
Background image of page 6
Attacking the Hold and Wait Attacking the Hold and Wait Condition Condition Require processes to request resources before starting a process never has to wait for what it needs Problems may not know required resources at start of run may wait for long to acquire all resources ties up resources other processes could be using Variation: before requesting a new resource, process must give up all resources then request all immediately needed
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 34

lecture15-chapter06 - Operating Systems Operating Lecture...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online