Let the resources
$\left ( R1,R2,R3 \right ) = \left ( 1,2,3 \right )$
Suppose A requests the resources in the order $\left ( 1,2,3 \right )$
and B can request the resources in any order $\left \{\left ( 1,2,3 \right ) (1,3,2) (2,1,3)(2,3,1)(3,1,2)(3,1,2) \right \}$
When Deadlock May Occur ?
- $A=\left ( 1,2,3 \right )$ ; $B=\left ( 2,1,3 \right )$
- $A=\left ( 1,2,3 \right )$ ; $B=\left ( 2,3,1 \right )$
- $A=\left ( 1,2,3 \right )$ ; $B=\left ( 3,1,2 \right )$
- $A=\left ( 1,2,3 \right )$ ; $B=\left ( 3,2,1 \right )$
When there is NO possibility of Deadlock ?
- $A=\left ( 1,2,3 \right )$ ; $B=\left ( 1,2,3 \right )$
- $A=\left ( 1,2,3 \right )$ ; $B=\left ( 1,3,2 \right )$
Hence, for 6 possible combinations for $A=\left ( 1,2,3 \right )$ , only 2 combinations are there which can never lead to Deadlock.
So, Required Fraction = $\frac{2}{6}$ = $\frac{1}{3}$