I am currently studying for a concurrent programming exam and don\'t understand why the output of this program is 43. Why is x = y + 1 executed before t.s
x = y + 1
t.s
t.start is before x = y + 1, it does not gurantee every line of code in run() method will be executed before x = y + 1.
t.start
run()
In fact, the printed result is uncertain without syncronization because of race condition, it could be 1 or 43.
1
43