0% found this document useful (0 votes)
5 views2 pages

Deadlock Management in Operating Systems

The document is a tutorial on deadlocks in operating systems, discussing how to manage resources and processes to avoid deadlock situations. It includes questions related to the banker's algorithm, conditions for deadlock, and starvation detection. Additionally, it presents scenarios involving resource allocation and requests from multiple processes to analyze system safety and resource management.

Uploaded by

zihanghay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Deadlock Management in Operating Systems

The document is a tutorial on deadlocks in operating systems, discussing how to manage resources and processes to avoid deadlock situations. It includes questions related to the banker's algorithm, conditions for deadlock, and starvation detection. Additionally, it presents scenarios involving resource allocation and requests from multiple processes to analyze system safety and resource management.

Uploaded by

zihanghay
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

FIST MULTIMEDIA UNIVERSITY

Tutorial 7- Deadlocks
1. In a real computer system, neither the resources available nor the demands of
processes for resources are consistent over long periods (months). Resources
break or are replaced, new processes come and go, new resources are bought and
added to the system. If deadlock is controlled by the banker's algorithms, which of
the following changes can be made safely (without introducing the possibility of
deadlock), and under what circumstances?

a) Increase Available (new resources added)


b) Decrease Available (resource permanently removed from the system)
c) Increase Max for one process (the process needs more resources than allowed,
it may want more)
d) Decrease Max for one process (the process decides it does not need that many
resources)
e) Increase the number of processes
f) Decrease the number of processes

2. Consider the following snapshot of a system:

Process Allocation Max Available


ABCD ABCD ABCD
P0 0012 0012 1520
P1 1000 1750
P2 1354 2356
P3 0632 0652
P4 0014 0656

Answer the following questions using the banker's algorithm:

a) What is the content of the matrix Need?


b) Is the system in a safe state?
c) If a higher priority request made by process P1 for (0,4,2,0) resources, can the
request be granted immediately?

3. Explain the four conditions that must hold for deadlock to occur.

4. Can a system detect that some of its processes are starving? If “yes” explain how
it can. If “no” explain how the system can deal with starvation problem.

5. Consider a system consisting of four resources of the same type that are shared by
three processes, each of which needs at most two resources. Show that the system
is deadlock-free.

Operating Systems [TOS 6113] Tutorial 7 - sol (7-1)


FIST MULTIMEDIA UNIVERSITY

6. Consider a system with Tape Drive, Printer and Scanner. 5 processes A, B, C, D,


E have the following requirements and current allocation for these resources.

Tape Drive Printer Scanner


Max Allocation Max Allocation Max Allocation
A 4 3 1 0 1 1
B 0 0 2 1 2 0
C 4 1 2 1 0 0
D 1 1 1 1 1 1
E 2 0 1 0 0 0

Available
Tape Drive Printer Scanner
1 0 0

a) Calculate the total number of instances for the tape drive, printer, and scanner.
b) Is the system in a safe state? If so give a safe allocation sequence. If not explain
why.
c) Suppose that process C request (2,0,0). Will the Banker’s algorithm grant the request?
Explain.

Operating Systems [TOS 6113] Tutorial 7 - sol (7-2)

You might also like