Maybe I misunderstand the example, but the problem of a "loose pointer" is the same as with single-core execution. If the base point can be partially written to memory, then different threads can see partial updates (if there is no corresponding blocking) on ​​any machine with proactive multitasking (even in a system with one processor).
You do not need to worry about the cache if you are not writing drivers for peripherals with DMA support. Modern multiprocessors are coherent, so the hardware ensures that the stream on processor A will have the same kind of memory as the stream on processor B. If the stream on A reads a memory cell that is cached on B, then the stream on A will get the correct value from cache Bs.
You need to worry about the values ​​in the registers and that the difference may not be visible, but in my opinion, involving the cache in the discussion of concurrency often just introduces unnecessary confusion.
Any operation designated “indivisible” in the ISA programming guide must reasonably remain indivisible in a multiprocessor system built with processors using this ISA or backward compatibility would break. However, this does not mean that operations that were never promised to be indivisible, but ended up in a specific processor implementation, will be inseparable in the future (for example, in a multiprocessor system).
[Edit] End of comment below
- Everything written to the memory will be coherently visible for all threads, regardless of the number of cores (in the cache, a coherent system).
- Everything that is written to memory non-atomically can turn out to partially read unsynchronized streams in the presence of preference (even in a single-core system).
If a pointer is written to an unrecognized address in one atomic write, then the caching coherence hardware will ensure that all threads see that it is complete or not at all. If the pointer is written non-atomically (for example, with two separate write operations), then any threads can see a partial update even in a single-core system with a true advantage.
source share