You are on page 1of 14

Operating Systems

AICT004-3-2

Process Control Management


Diploma in Computing and IT
Level 1

Prepared by: ANI First Prepared on: 13-12-04 Last Modified on: 23-06-2008
Quality checked by: MNI
Copyright 2008 Asia Pacific Institute of Information Technology
Topic & Structure of the lesson
Process Control Management

Deadlock Avoidance

Deadlock Detection

Deadlock Recovery

Operating Systems Slide 2 of 14


Learning Outcomes
Process Control Management

At the end of this lecture YOU should be able to:

- describe how deadlocks are avoided

- explain how deadlocks are detected

- demonstrate strategies to recover from


deadlocks

Operating Systems Slide 3 of 14


Key Terms you must be able to use
Process Control Management

If you have mastered this topic, you should be able to use


the following terms correctly in your assignments and
exams:

deadlock avoidance
deadlock detection
deadlock recovery

Operating Systems Slide 4 of 14


Deadlock Avoidance
Process Control Management

deadlock avoidance requires additional information on


how resources will be requested

Example :
- in a system with one printer and one tape drive, we
might be told that process P will request the tape first
and then the printer before releasing both resources;
process Q would request for the printer first and the
tape drive later

with the knowledge of complete sequence of requests


and releases the operating system can now decide on
which processes should wait or proceed

Operating Systems Slide 5 of 14


Deadlock Avoidance
Process Control Management

each request for a resource will now need the operating


system to consider the resources currently available,
resources allocated, future request and releases for each
process before deciding if the current request can be
satisfied or halted to prevent a deadlock

algorithms are used for each process to declare the


maximum number of resources needed

Operating Systems Slide 6 of 14


Deadlock Detection
Process Control Management

if a system does not cater for deadlock prevention or


avoidance then deadlock detection and recovery is
employed

an algorithm is used to examine the state of the system


to determine if a deadlock has occurred

detection and recovery incurs overheads for executing


the detection algorithm with possible losses from
recovering from a deadlock

Operating Systems Slide 7 of 14


Deadlock Recovery
Process Control Management
when a detection algorithm detects a deadlock, recovery
methods could be:

- to inform the operator and the operator deals with


the deadlock manually

- to let the system recover from the deadlock


automatically

- to break the deadlock

(i) process termination- abort all deadlocked


processes or abort one process at a time until
the deadlock is eliminated
Operating Systems Slide 8 of 14
Deadlock Recovery
Process Control Management

(ii) resource preemption - preempt some resources from


processes and give these resources to other
processes until the deadlock cycle is broken

Operating Systems Slide 9 of 14


Quick Review Questions
Process Control Management

Can deadlocks occur in a single user operating system?

Operating Systems Slide 10 of 14


Follow Up Assignment
Process Control Management

How does deadlock avoidance work?

How does a system recover from a deadlock if the


system does not employ deadlock prevention and
avoidance?

Operating Systems Slide 11 of 14


Summary of Main Teaching Points
Process Control Management

Deadlock avoidance uses an algorithm to determine


how resources are being requested.

Deadlock detection is implemented using algorithms to


investigate the state of the system.

Deadlock recovery is done to ensure that the system


does not cripple throughput which will cause
CPU utilization to drop.

Operating Systems Slide 12 of 14


Question and Answer Session
Process Control Management

Q&A

Operating Systems Slide 13 of 14


Next Session
Process Control Management

Memory Management

Operating Systems Slide 14 of 14

You might also like