Because atomicity of the read-modify-write operation is not ensured in the above example, the result in diff is going to be incorrect since T0 and T1 both load the old value of diff and only add their own partials to it before writing back. At no point do the two partial sums interact. (Note that the example assumes diff is 0 and that 1 is stored in both registers r2.)
Because atomicity of the read-modify-write operation is not ensured in the above example, the result in
diff
is going to be incorrect since T0 and T1 both load the old value ofdiff
and only add their own partials to it before writing back. At no point do the two partial sums interact. (Note that the example assumesdiff
is 0 and that 1 is stored in both registers r2.)This comment was marked helpful 1 times.