GATE - 2010 | OS | A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.

GATE - 2010 | OS | A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.
Posted on 13-02-2022

GATE - 2010 [Operating System]

Question:

A system has n resources R0,...,Rn-1,and k processes P0,....Pk-1.The implementation of the resource request logic of each process Pis as follows:

if (i % 2 == 0) {

      if (i < n) request Ri

      if (i+2 < n) request Ri+2

}

else {

      if (i < n) request Rn-i

      if (i+2 < n) request Rn-i-2

}

In which one of the following situations is a deadlock possible?  

A

n = 40, k = 26

B

n = 21, k = 12

C

n = 20, k = 10

D

n = 41, k = 19

   

Solution:

Option (B) is Correct.

Consider the case where i = 10 & i = 11, n = 21 & k = 12
P10 requests R10 & R11
P11 requests R10 & R8
Hence P10 & P11 inorder in deadlock.

Thank You

Download App for Free PDF Download

GovtVacancy.Net Android App: Download

government vacancy govt job sarkari naukri android application google play store https://play.google.com/store/apps/details?id=xyz.appmaker.juptmh