<< Previous exercise (3.38)
| Index |
Next exercise (3.40) >>
121 - P2 then P1
101 - P1 then P2
100 - P1 gets x^2 to be 100. Then P2 sets x after which P1 sets x to be 100.
110 cannot be done since x^2 will not be interleaved with P2 which means the value of x will be the same meaning it is either 100 or 121.
11 cannot be done since once P2 starts, P1 cannot finish until P2 is done.
I believe the above is wrong and
110: P2 changes x from 10 to 11 between the two times that P1 accesses the value of x during the evaluation of (* x x).
is indeed possible. The serializer doesn't protect P1 at all.
@leafac I think adams is right, as "(s (lambda () (* x x))))" protected the (* x x) from interleaved, P2 can not changes x between the two times that P1 accessed the x.