438 views
0 votes
0 votes

Consider a system having 'm' resources of the same type. These resources are shared by 3 processes A, B, C, which have peak time demands of 3, 4, 6 respectively. The minimum value of 'm' that ensures that deadlock will never occur is

A.

11

B.

12

C.

13

D.

14

I know the answer  is 11.But how?

1 Answer

Best answer
0 votes
0 votes
Okay, suppose There are three processes A, B, C which require 3 blocks of memory,4 blocks, and 6 blocks respectively for execution.
Now the naive solution to ensure that deadlock never occur is to allocate all the demanded blocks before hand but it would cost me 13 blocks of memory.

So optimized method is to allocate A 2 blocks, B 3 blocks, C 5 blocks i.e demand-1. Now why short of 1 only because that way I being resource allocator is aware of the fact that maximum 1 block of memory a process would need at some point of time to complete its execution okay?
Now Suppose after sometime B complete its 3blocks memory part say some calculation or storage and demand for the 1block of memory ,

Here i would allocate it knowing that after this it releases all its blocks because ultimately it completes execution.Now after completion All 4 blocks of memory allocated to B are free and thus it ensures that no deadlock will occur.
And it costs me 5+3+2+1(extra one)=11 blocks of resources
selected by

Related questions

0 votes
0 votes
1 answer
1