Two processes $P_1$ and $P_2$ have a common shared variable count. While $P_1$ increments it, $P_2$ decrements it. Given that $R_0$ is a register, the corresponding assembly language codes are:
$P_1$ |
count++ |
|
$P_2$ |
count-- |
|
MOV |
$count$ |
$R_0$ |
MOV |
$count$ |
$R_0$ |
ADD |
#1 |
$R_0$ |
SUB |
#1 |
$R_0$ |
MOV |
$R_0$ |
$count$ |
MOV |
$R_0$ |
$count$ |
$$\begin{array}{} \hline P_{1} & & \text{count}++ & & & P_{2} & \text{count}-- \\\hline \text{MOV} & & \text{count} & \: R_{0} & &\text{MOV} & \text{count} &\: R_{0} \\\hline \text{ADD} & & \#1 & \: R_{0} & &\text{SUB} &\#1 &\: R_{0} \\\hline \text{MOV} & & R_{0} & \text{count} & &\text{MOV} & \: R_{0} & \text{count} \\ \hline \end{array}$$
Give an example to justify whether a race condition may occur if $P_1$ and $P_2$ are executed simultaneously.