The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+14 votes
2.7k 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 (105k points)
edited | 2.7k views
+1

Pigeonhole Principle :)

5 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 (362k 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 (9.1k 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.6k points)
0 votes
As we know from the resource-request algorithm, which is a variant of Banker's algorithm-

Demand < Number of processes + Number of resources

now, the demand is 3 tape drives for each of the three programs, therefore 9.

let the minimum number of tapedrives or resources be R.

So,

9 < 3 + R

$\therefore$ R > 6. So minimum number of tapedrives should be 7.
answered ago by Active (1.5k points)
0

@Gupta731

WHAT WILL BE IN CASE OF WHEN THREE POCESS  P1, P2 , P3 REQUIRED 4 , 2 , 5 TAPEDRIVERS.

WHAT WILL BE THE MUNIMUM NUMBER OF TAPE DRIVERS,DEADLOCK NEVER ARISE ??? 

0

Your doubt will be cleared if you try the process I explained on this question.

https://gateoverflow.in/1800/gate2014-1-31

see how easily you can solve it. Just calculate the need and available for the three processes and apply the above concept.

0

@Gupta731

Please solve according to your above concept ???

0
In that question the NEED on calculating comes out to be (8,4,2), (3,0,0), (1,2,2) for processes P0,P1,P2 respectively.

And the available is given (3,2,2)

According to resouce request algorithm:

Request <= Need

Request < Available

which only request 2 satisfies.
0

@Gupta731

I'm asking the answer of this question??

WHAT WILL BE IN CASE OF WHEN THREE POCESS  P1, P2 , P3 REQUIRED 4 , 2 , 5 TAPEDRIVERS.

WHAT WILL BE THE MUNIMUM NUMBER OF TAPE DRIVERS,DEADLOCK NEVER ARISE ??? 

+1
Oh, in that case demand will be 4+2+5 = 11.

Demand < no of processes + no of resources

11 < 3 + R

R > 8

so minimum number of resources or tapedrives in that case would be 9.
+1
Thanks.
Answer:

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

42,492 questions
48,519 answers
154,905 comments
63,259 users