You are on page 1of 2

Operating System (Chapter 7)

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 brought 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)
i. Anytime
b. Decrease Available (resources permanently removed from the system)
i. Only if MAX demand of each process does not exceed total number of available
resources and the system remains in a safe state
c. Increase MAX for one process (the process needs more resources than allowed, it may
want more)
i. Only if MAX demand of each process does not exceed total number of available
resources and the system remains in a safe state
d. Decrease MAX for one process (the process decides it does not need that many
resources)
i. Anytime
e. Increase the number of processes
i. Anytime; as long as the system can still achieve a safe state
f. Decrease the number of processes
i. Anytime

2. Explain the four conditions that must hold for deadlock to occur
a. Mutual exclusion
i. Only one process at a time can use a resource. If another process requests that
resource, the requesting process must be delayed until the resource has been
released.
b. Hold and wait
i. A process holding at least one resource is waiting to acquire additional
resources held by other processes
c. No preemption
i. A resource can be released only voluntarily by the process holding it, after that
process has completed its task
d. Circular Wait
i. There exists a set {P0, P1, … P0} of waiting processes such that P0 is waiting for a
resource that is held by P1, P1 is waiting for a resource that is held by P2,….,Pn-1
is waiting for a resource that is held by Pn, and Pn is waiting for a resource that
is held by P0.
3. 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.
a. Cannot detect starvation because it requires future knowledge and no amount of
record-keeping statistics on processes can determine if it is making “progress” or not
b. Starvation can be prevented through aging progress
i. This means maintaining a rollback count for each process, and including this as
part of cost factor in selection process for a victim for preemption/rollback

4. 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
a. Suppose the system is deadlocked
b. This implies that each process is holding one resource and is waiting for one more
c. Since there are three processes and four resources, there is another free resource to be
claimed by one of the processes
d. This process has acquired two resources and can complete, then it will return resources
being held by it

You might also like