Skip to content
Related Articles

Related Articles

GATE | Gate IT 2005 | Question 62
  • Difficulty Level : Expert
  • Last Updated : 28 Dec, 2015

Two shared resources R1 and R2 are used by processes P1 and P2. Each process has a certain priority for accessing each resource. Let Tij denote the priority of Pi for accessing  Rj. A process Pi can snatch a resource Rh from process Pj if Tik is greater than Tjk.
Given the following :

  1. T11 > T21
  2. T12 > T22
  3. T11 < T21
  4. T12 < T22

Which of the following conditions ensures that P1 and P2 can never deadlock?

 
(A) (I) and (IV)
(B) (II) and (III)
(C) (I) and (II)
(D) None of the above


Answer: (C)

Explanation:
If all the resources are allocated to one process then deadlock will never occur.
So, if we allocate both R1 and R2 to process P1 or both R1 and R2 to process P2 then deadlock can be prevented.
When one process completes its execution then both the resources are allocated to the other process.
So, either condition (I) and (II) or condition (III) and (IV) ensures that deadlock never occurs.

 
Thus, option (C) is correct.

 
Please comment below if you find anything wrong in the above post.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :