in Operating System
263 views
0 votes
0 votes

Original question - https://gateoverflow.in/3823/gate2005-it-62

 

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?

  1. (I) and (IV)
  2. (II) and (III)
  3. (I) and (II)
  4. None of the above

 

 

==============================================================================================

 

Someone please explain how to interpret this line - 

A process Pi can snatch a resource Rh from process Pj if Tik is greater than Tjk

in Operating System
by
263 views

4 Comments

@Shaik Brother will you please check.
0
0
Let us say that a resource R2 is currently held by process P2, If another process (say P1) has higher priority then P2 to access the resource, then the resource can be provided to P1....

I think in place of Rh it should be Rk then it will make sense!
1
1

in the question they given the notation that

Let Tij denote the priority of Pi for accessing  Rj.

It means Pi is need Rj .

 

one more notation, they mention

A process Pi can snatch a resource Rh from process Pj if Tik is greater than Tjk.  

note that as  @himgta said, actually the line is printed mistakenly

A process Pi can snatch a resource Rk from process Pj if Tik is greater than Tjk.  

it means when Pi and Pj both needs the the resource Rk at a time, there is a tie between them, for breaking that tie they announce either Tik > Tjk , it means process Pi is prioritize than process Pj .

 

coming to the question... they are interested in never happens the DEADLOCK

if there is a tie ===> Deadlock due to we can't say either P1 or P2 granted for the particular resource

if you didn't get how it is going to deadlock....

T11 and T21 it means both P1 and P2 needs R1 ===> allocate R1 to P1.

T12 and T22 it means both P1 and P2 needs R2 ===> allocate R2 to P2.

for completing the process, every Process needs both R1 and R2 ===> Hence it is in deadlock

 

For what to do to avoid deadlock?

either allocates two resources to P1 or r allocates two resources to P2.

allocating two resources to P1

T11 > T21 , and T12 > T22 

allocating two resources to P2

( T11 < T21 , and T12 < T22  ) = ( T21 > T11 , and T22 > T12  )

1
1
@Shaik @himgta. Thanks a lot both of you! :)
0
0

Please log in or register to answer this question.

Related questions