12-Deadlocks_III

12-Deadlocks_III - CSE 421/521 - Operating Systems Fall...

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

View Full Document Right Arrow Icon
1 CSE 421/521 - Operating Systems Fall 2011 Tevfik Ko ş ar University at Buffalo October 11 th , 2011 Lecture - XII Deadlocks & Main Memory Management 2 Roadmap • Deadlocks Resource Allocation Graphs Deadlock Detection Deadlock Prevention Deadlock Avoidance Deadlock Recovery • Main Memory Management 3 Deadlock Avoidance Deadlock Prevention: prevent deadlocks by restraining resources and making sure one of 4 necessary conditions for a deadlock does not hold. (system design) --> possible side effect: low device utilization and reduced system throughput Deadlock Avoidance: Requires that the system has some additional a priori information available. (dynamic request check) i.e. request disk and then printer. . or request at most n resources --> allows more concurrency Similar to the difference between a trafFc light and a police ofFcer directing the trafFc! 4 Deadlock Avoidance • Simplest and most useful model requires that each process declare the maximum number of resources of each type that it may need. • The deadlock-avoidance algorithm dynamically examines the resource-allocation state to ensure that there can never be a circular-wait condition. • Resource-allocation state is defined by the number of available and allocated resources, and the maximum demands of the processes. 5 Example P1: Request Disk Request Printer .... Release Printer Release Disk P2: Request Printer Request Disk .... Release Disk Release Printer 6 Safe State • A state is safe if the system can allocate resources to each process (upto its maximum) in some order and can still avoid a deadlock. • When a process requests an available resource, system must decide if immediate allocation leaves the system in a safe state. • System is in safe state if there exists a safe sequence of all processes.
Background image of page 1

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

View Full DocumentRight Arrow Icon
7 Safe State • Sequence <P 1 , P 2 , …, P n > is safe if for each P i , the resources that P i can still request can be satisfied by currently available resources + resources held by all the P j , with j<i. If P i resource needs are not immediately available, then P i can wait until all P j have finished. When P j is finished, P i can obtain needed resources, execute, return allocated resources, and terminate. When
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

12-Deadlocks_III - CSE 421/521 - Operating Systems Fall...

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

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