The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+14 votes
2.6k views
A system contains three programs and each requires three tape units for its operation. The minimum number of tape units which the system must have such that deadlocks never arise is _________.
asked in Operating System by Veteran (101k points)
edited | 2.6k views
+1

Pigeonhole Principle :)

4 Answers

+19 votes
Best answer
Up to, $6$ resources, there can be a case that all process have $2$ each and dead lock can occur. With $7$ resources, at least one process's need is satisfied and hence it must go ahead and finish and release all $3$ resources it held. So, no dead lock is possible.
answered by Veteran (357k points)
selected by
0
What if we think this manner, let the number of resources be 3 i.e. 3 tape units are given. These can be allocated to any one process, which after execution will free those 3 tape units. Now these 3 can be given to the other waiting process which will free it after sometime and lastly, give it to 3rd waiting process. The only disadvantage of this is the processes may suffer from starvation. But can't minimum number of resources be 3?
+25 votes
For these type of problems in which every process is making same number of requests, use the formula    

$$n.(m-1)+1\leq r$$
where,
$n= \text{ no. of processes}$
$m=\text{resource requests made by processes}$
$r=\text{no. of  resources}$

So, in above problem we get $3.(3-1)+1\leq r \implies   r \geq 7$

 Minimum number of resource required to avoid deadlock is $7.$
answered by Active (4.1k points)
+8 votes

Max number of resourses by which deadlock happen

P1=2

P2=2

P3=2

So Max=6 deadlock will occur

therefore minimum number of resourses by which deadlock not happen=6+1>=7

answered by Loyal (8.9k points)
+2 votes
If 6 resources are there then it may be possible that all three process have 2 resources and waiting for 1 more resource. Therefore, all of them will have to wait indefinitely. If 7 resources are there, then atleast one must have 3 resources so deadlock can never occur.
answered by Loyal (8.4k points)


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

39,440 questions
46,623 answers
139,377 comments
57,026 users