edited by
20,986 views
39 39 votes

A computer has six tape drives, with $n$ processes competing for them. Each process may need two drives. What is the maximum value of $n$ for the system to be deadlock free?

  1. $6$
  2. $5$
  3. $4$
  4. $3$

4 Answers

Best answer
40 40 votes

Each process needs $2$ drives

Consider this scenario           

$\begin{array} {|c |c| c| c| c|}\hline  P_{1} & P_{2} & P_{3} & P_{4} & P_{5} & P_{6} \\ \hline 1 & 1 & 1 & 1 & 1 & 1\\ \hline \end{array}$ 

This is scenario when a deadlock would happen, as each of the process is waiting for $1$ more process to run to completion. And there are no more Resources available as max $6$ reached. If we could have provided one more $R$ to any of the process, any of the process could have executed to completion, then released its resources, which further when assigned to other and then other would have broken the deadlock situation.

In case of processes, if there are less than $6$ processes, then no deadlock occurs.

Consider the maximum case of $5$ processes.

$\begin{array} {|c| c| c| c| c|}\hline  P_{1} & P_{2} & P_{3} & P_{4} & P_{5}  \\ \hline 1 & 1 & 1 & 1 & 1 \\ \hline \end{array}$ 

In this case system has $6$ resources max,and hence we still have $1$ more $R$ left which can be given to any of the processes, which in turn runs to completion, releases its resources and in turn others can run to completion too.

Answer (B).

edited by
19 19 votes
For a system to be deadlock free, Sum of max need of processes < No. of processes + No. of resources

2n < n+6

Max value of n = 5.
edited by
11 11 votes

6 resources, n processes and maximum demand for each process is 2.

For getting maximum value of n,

Consider an extreme case of deadlock wherein a chain of n processes, each process just only needs 1 more resource to start execution. Means each process has been allocated resources equal to 1 less than its actual demand.

Now, if we have 1 more resource, in our system, then this chain of deadlock can be broken and then the deadlock will never occur.

N*(2-1) (Give all n processes 1 less resource than max demand) +1 (This extra resource will break deadlock ) = 6

N+1=6

N=5.

Cross Check

P1 P2 P3 P4 P5
1 1 1 1 1

Now, only 1 resource remaining and this will break above chain of deadlocked processes.

Hence, answer-5

2 2 votes

Answer :  B

R >= p(x-1)+1  // R: total resource , p: total process , x: max need of each process

6 >= n( 2-1)+1

6 >= n+1

n <= 5 , so maximum process to free from deadlock = 5

Answer:
Position:
Show:

Related questions

34 34 votes
4 answers 4 answers
18.7k
18.7k views
Kathleen asked Sep 25, 2014
18,745 views
Which of the following devices should get higher priority in assigning interrupts?Hard diskPrinterKeyboardFloppy disk
65 65 votes
10 answers 10 answers
24.4k
24.4k views
Arjun asked Jul 10, 2015
24,407 views
In a computer system where the ‘best-fit’ algorithm is used for allocating ‘jobs’ to ‘memory partitions’, the following situation was encountered:$$\begin{array}{|l|l|} \...
4 4 votes
1 1 answer
4.5k
4.5k views
Kathleen asked Sep 26, 2014
4,506 views
Calculate the total time required to read 35 sectors on a 2-sided floppy disk. Assume that each track has 8 sectors and the track-to-track step time is 8 milliseconds. Th...
140 140 votes
11 answers 11 answers
37.1k
37.1k views
Kathleen asked Sep 25, 2014
37,104 views
Consider $n$ processes sharing the CPU in a round-robin fashion. Assuming that each process switch takes $s$ seconds, what must be the quantum size $q$ such that the over...