$\text{(a) - For Max Value}$
$P_1$ |
$P_2$ |
$P_3$ |
$W(S)$ |
$W(S)$ |
$W(S)$ |
$R(D)$ |
$R(D)$ |
$R(D)$ |
$\color{red}{C.S\space to \space P_2}\color{blue}{\space D = 100 \space here}$ |
|
|
$D = D+ 20$ |
$D = D- 50$ |
$D = D+ 10$ |
$W(D)$ |
$W(D)$ |
$W(D)$ |
$P(S)$ |
$P(S)$ |
$P(S)$ |
Start from either $P_1$ or $P_3$ In my case starting from $P_1$ so $P_1$ have $D = 100$ after read it context switched and given charge to $P_2$ ${\color{green}{\text{Why $P_2$ because it can decrease D's value }}}$ so $D's$ value became $50$ now charge returned to $P_1$ but here in $P_1$ D's value is aleady set so here $\text{LOST UPDATE}$ problem arises, so $D = 100+20 = 120$ , Now $P_3$ will start execution. Eventually $D = 120+10 = 130$ so $Y = 130$
$\text{(b) - For Min Value}$
$P_1$ |
$P_2$ |
$P_3$ |
$W(S)$ |
$W(S)$ |
$W(S)$ |
$R(D)$ |
$R(D)$ |
$R(D)$ |
|
$\color{red}{C.S\space to \space P_1}\color{blue}{\space D = 100 \space here}$ |
|
$D = D+ 20$ |
$D = D- 50$ |
$D = D+ 10$ |
$W(D)$ |
$W(D)$ |
$W(D)$ |
$P(S)$ |
$P(S)$ |
$P(S)$ |
We'll start from $P_2$ because it contains negative operation and similiar execution done as $(a)$ so $D = 100 - 50$, $X = 50$
Then the value of $Y - X = 130 - 50 = 80$