Arjun Suresh (talk | contribs) |
Arjun Suresh (talk | contribs) |
||
Line 1: | Line 1: | ||
− | A system has <math>n</math> resources <math> | + | A system has <math>n</math> resources <math>R_0 ,..., R_n-1</math> , and <math>k</math> processes <math>P_0 ,.....P_{k-1}</math> . The implementation of the resource |
− | request logic of each process <math> | + | request logic of each process <math>P_i</math> . is as follows: |
<syntaxhighlight lang="c"> | <syntaxhighlight lang="c"> | ||
if (i% 2==0) { | if (i% 2==0) { | ||
− | if (i<n) request | + | if (i<n) request R_i ; |
if (i+2<n)request R i+2 ; | if (i+2<n)request R i+2 ; | ||
} | } |
A system has <math>n</math> resources <math>R_0 ,..., R_n-1</math> , and <math>k</math> processes <math>P_0 ,.....P_{k-1}</math> . The implementation of the resource request logic of each process <math>P_i</math> . is as follows: <syntaxhighlight lang="c"> if (i% 2==0) {
if (i<n) request R_i ; if (i+2<n)request R i+2 ;
} else {
if (i<n) request R n-i ; if (i+2<n)request R n-i-2 ;
} </syntaxhighlight> 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
A system has <math>n</math> resources <math>R 0 ,..., R n-1</math> , and <math>k</math> processes <math>P 0 ,.....P k-1</math> . The implementation of the resource request logic of each process <math>P i</math> . is as follows: <syntaxhighlight lang="c"> if (i% 2==0) {
if (i<n) request R i ; if (i+2<n)request R i+2 ;
} else {
if (i<n) request R n-i ; if (i+2<n)request R n-i-2 ;
} </syntaxhighlight> 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