The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+17 votes

An operating system contains $3$ user processes each requiring $2$ units of resource $R$. The minimum number of units of $R$ such that no deadlocks will ever arise is

- $3$
- $5$
- $4$
- $6$

+14 votes

Best answer

If we have $X$ number of resources where $X$ is sum of $r_i-1$ where $r_i$ is the resource requirement of process $i$, we might have a deadlock. But if we have one more resource, then as per Pigeonhole principle, one of the process must complete and this can eventually lead to all processes completing and thus no deadlock.

Here, $n = 3$ and $r_i = 2$ for all $i$. So, in order to avoid deadlock **minimum** no. of resources required

$=\displaystyle{\sum_{i=1}^{3}} (2-1) + 1 = 3 + 1 = 4.$

PS: Note the **minimum** word, any higher number will also cause no deadlock.

+18 votes

Answer: C

(a) 1-1-1 allocation of resources can cause a deadlock.

(c) 2-1-1 is the general resource allocation which will never cause a deadlock as the process getting 2 resources will release its resources after its task is over.

(a) 1-1-1 allocation of resources can cause a deadlock.

(c) 2-1-1 is the general resource allocation which will never cause a deadlock as the process getting 2 resources will release its resources after its task is over.

+9 votes

For a system to be deadlock free ,

Sum of max need of processes < No. of processes + No. of resources

Given , 3 user processes each requiring 2 units of resource , so max need of processes = 3 *2 = 6 .

Number of process = 3 , Number of resources = R

so 6 < 3 + R

=> 3 < R

so R must be 4 to be Not in deadlock( minimum value ) . Any value more than 4 is maximum value ..

Sum of max need of processes < No. of processes + No. of resources

Given , 3 user processes each requiring 2 units of resource , so max need of processes = 3 *2 = 6 .

Number of process = 3 , Number of resources = R

so 6 < 3 + R

=> 3 < R

so R must be 4 to be Not in deadlock( minimum value ) . Any value more than 4 is maximum value ..

+6 votes

Minimum resourses by which deadlock will not happened will be 4

Explanation::

Max resourses by which deadlock happen is like

P1=1

P2=1

P3=1

**So Max resourses by which deadlock happen is =3 so minimum number of resourses by which deadlock did not happen=4**

0 votes

Let use the formulae,

n*k - (n - 1) or (Total Number Process * Total Number of Resource ) - (Total Process -1 )

then,

= 3*2 - (3 - 2)

= 4

For Example : There are 8 process and each require 2 resources to complete the task. So the Minimum number of resource which guarantee the dead lock free is 10

=8*2 -(8-2)

=10

n*k - (n - 1) or (Total Number Process * Total Number of Resource ) - (Total Process -1 )

then,

= 3*2 - (3 - 2)

= 4

For Example : There are 8 process and each require 2 resources to complete the task. So the Minimum number of resource which guarantee the dead lock free is 10

=8*2 -(8-2)

=10

0 votes

Step(1)Create circular wait of processes where each process in the set is waiting for other to complete. How this is done is, give each process exactly 1 less the maximum number of resource it demands.

$P_1$ | $P_2$ | $P_3$ |

1 | 1 | 1 |

Now every process in the set is holding and waiting and the circular wait is created. Deadlock!!

Step (2). Now give one extra resource, so that any one process is able to complete, hence circular wait is broken.!

so 3+1=4 resources required to never fall into a deadlock

and Maximum 3 resources can be there for the deadlock to happen.

- All categories
- General Aptitude 1.6k
- Engineering Mathematics 7.5k
- Digital Logic 3k
- Programming & DS 4.9k
- Algorithms 4.3k
- Theory of Computation 5.9k
- Compiler Design 2.1k
- Databases 4.2k
- CO & Architecture 3.5k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 588
- Exam Queries 568
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,071 questions

53,207 answers

184,562 comments

70,425 users