A system has $n$ resources $R_0, \dots,R_{n-1}$, and $k$ processes $P_0, \dots, P_{k-1}$ ($n > k$). The implementation of the resource request logic of each process $P_i$ is as follows:
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-1}$;
if (i+2 <n) request $R_{n-i-2}$;
}
Is it deadlock free? If not, what is the minimum value of $n + k$ for which deadlock is possible?