How many value of x are there?
posted 3 years ago
There's the main memory version. Then either or both of the threads may (or may not) have a cached version. We don't know when the threads will run, and we don't know when they'll read the main version or if or when they'll write it. There could be one value, if both threads read 0 from main and write 1 back to it. Or there could be 2 values, 0 and 1 or 1 and 2, where the smaller value is held in main mem and one thread's cache, and the larger value is in the other thread's cache.