Question OS-SYNC-0043
MediumShared x = 5. Without any locking, one thread runs x = x + 1 and another runs x = x − 1 at the same time (each as load, change, store). Which final values of x are possible?
- A.
4, 5 or 6
- B.
Only 5
- C.
Only 4 or 6
- D.
Any integer
Sign up free to see the answer and a step-by-step explanation.