The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+16 votes

02. Choose the correct alternatives (more than one may be correct) and write the corresponding letters only:

(xi) A computer system has $6$ tape devices, with n processes competing for them. Each process may need $3$ tape drives. The maximum value of n for which the system is guaranteed to be deadlock-free is:

  1. $2$
  2. $3$
  3. $4$
  4. $1$
asked in Operating System by Veteran (52k points)
edited by | 763 views

2 Answers

+3 votes
Best answer
Allocate $max-1$ resources to all processes and add one more resource to any process (Pigeon hole principle) so that this particular process can be completed (resources can be freed) and there is no deadlock.

Max resources required is $3$.

$\therefore$ $(3-1)*n+1=6$

$n=\left \lfloor \frac{5}{2} \right \rfloor=2$

Correct Answer: $A$
answered by Boss (11k points)
edited by
+17 votes

Answer: (A).

For $n=3$, $2-2-2$ combination of resources leads to deadlock.

For $n=2$, $3 - 3$ is the maximum need and that can always be satisfied.

answered by Boss (33.8k points)
edited by
I may be a bit late to ask this question. But nonetheless...

Consider there are 4 processes and each process has 1 resource. There will be two resources remaining. One of the four process may ask for 2 resources and the resulting state will be a safe state. (Infact, one of the resource can request only one tape device and even after that it will be in safe state.) So the max process will be 4(option C) right?

your assumption is good. But you should take care of question statement in the question statement it has been said that 

"The maximum value of n for which the system is guaranteed to be deadlock free is"

here guaranteed word is used and due to this word your answer is not correct so if guaranteed is not used in question statement in that case you may be correct.


@GaneshA We can come up with many such allocation which will not cause deadlock. Question is asking "guaranteed to be deadlock free". Even if there is is a single case causing deadlock, it will not be considered.

Worst case allocation is all process gets one less than their maximum demand and all are blocked as after such assignment no one goes to completion.


Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,576 questions
54,190 answers
71,147 users