COMP 409 Lecture 3: Lecture3 2018
Document Summary
Note: it was never the case in the original code that y + z = 2. The only real possibilities of the original code are x = 0, 1 or 3. Possible values depend on the atomicity of our operations: need to know (cid:314) depend on the hardware and the language. Usually : assignment of constants is atomic to a machine word sized value. If the data type is larger than a word, e. g. : x is 64-bits on a 32-bit machine will be assigned in separate steps x = 0 (cid:314) x. upper32 = 0, x. lower32 = 0. Long long x (cid:1379) (cid:1378) x = 0 x = -1. Will not get a mix of bits x = y + z x = y x += z. Java: either see the old, or the new. In java, assignment to a word-sized variable is atomic, but computation may not be.