Menu Close

Assignment Two: deadlocks OS SP15

Answer following questions

Q:1 The four conditions (mutual exclusion, hold and wait, no preemption and circular
wait) are necessary for a resource deadlock to occur. Give an example to show that
these conditions are not sufficient for a resource deadlock to occur. When are these
conditions sufficient for a resource deadlock to occur?

Q:2 Suppose that there is a resource deadlock in a system. Give an example to show that
the set of processes deadlocked can include processes that are not in the circular chain
in the corresponding resource allocation graph.

Q:3 In theory, resource trajectory graphs could be used to avoid deadlocks. By clever
scheduling, the operating system could avoid unsafe regions. Suggest a practical
problem with actually doing this.

Q:4 A computer has six tape drives, with n processes competing for them. Each process
may need two drives. For which values of n is the system deadlock free?

Q:5 In an electronic funds transfer system, there are hundreds of identical processes that
work as follows. Each process reads an input line specifying an amount of money, the
account to be credited, and the account to be debited. Then it locks both accounts and
transfers the money, releasing the locks when done. With many processes running in
parallel, there is a very real danger that having locked account x it will be unable to
lock y because y has been locked by a process now waiting for x. Devise a scheme
that avoids deadlocks. Do not release an account record until you have completed the
transact ions. (In other words, solutions that lock one account and then release it immediately if the other is locked are not allowed.)


  • Questions are taken from Modern Operating Systems book ed 3
  • Deadline Wed 10 June 1630 hours

Leave a Reply

Your email address will not be published. Required fields are marked *