I don't know where this question is originated but it seem incorrect, it's like guessing rather than conceptual

Dark Mode

Bikram
asked
in Operating System
Sep 3, 2016

783 views
6 votes

Consider a system having 'm' resources of the same type. These resources are shared by 3 processes A, B and C, which have peak time demands of 3, 4 and 6. The minimum value of 'm' that ensures that deadlock will never occur given that the combined maximum resource requirement of processes B and C at any time is 8 will be ______.

13 votes

Best answer

Answer is - 9

B and C at any time require maximum 8 resources. So, for deadlock to happen, only 6 resources must be allocated to B and C together. (If 7 is allocated either B or C can continue execution). Since A has peak demand of 3, in worst case for deadlock, it must be allocated 2 resources. So, maximum no. of resources that can be allocated during deadlock is 6 + 2 = 8. With 1 extra resource deadlock won't happen and hence answer is 9.

B and C at any time require maximum 8 resources. So, for deadlock to happen, only 6 resources must be allocated to B and C together. (If 7 is allocated either B or C can continue execution). Since A has peak demand of 3, in worst case for deadlock, it must be allocated 2 resources. So, maximum no. of resources that can be allocated during deadlock is 6 + 2 = 8. With 1 extra resource deadlock won't happen and hence answer is 9.

0

@Arjun sir

kindly check this

B and c combined need

(1,7) or (2,6) or (3,5),(4,4)-----we have to allocate 6 resources to both in a combined manner for deadlock

Is this reasoning valid

1

0 votes

in case of 8

imagine A is given 2, B is given 3 and C is given 3 WHERE A needed 3, B needed 4 and C needed 4 (how?)

A demands 2 resources and goes to sleep. B demands 3 and sleeps. C demands 3 and sleeps. Now anyone could wake and find 0 resources available.

it'll be a deadlock

there are only 3 combinations, BC can demand i.e. B-C demands 3-5 or 4-4 or 2-6 (because sum should be 8). In case of 9, suppose A takes away 2, 7 remaining. This 7 can be easily distributed among those 3 combinations while satisfying the need of any 1 completely.

imagine A is given 2, B is given 3 and C is given 3 WHERE A needed 3, B needed 4 and C needed 4 (how?)

A demands 2 resources and goes to sleep. B demands 3 and sleeps. C demands 3 and sleeps. Now anyone could wake and find 0 resources available.

it'll be a deadlock

there are only 3 combinations, BC can demand i.e. B-C demands 3-5 or 4-4 or 2-6 (because sum should be 8). In case of 9, suppose A takes away 2, 7 remaining. This 7 can be easily distributed among those 3 combinations while satisfying the need of any 1 completely.

0