I am studying operating systems from Operating System Concepts by Silberschatz, Galvin, and Gagne.
On page 229, the book states this about Petersons Solution :
Because of the way modern computer architectures perform basic machine language instructions, such as load and store, there are no guarantees that Peterson's solution will work correctly on such architectures.
I looked this up on Wikipedia and found this which appears to be the closest to an explanation :
Most modern CPUs reorder memory accesses to improve execution efficiency. Such processors invariably give some way to force ordering in a stream of memory accesses, typically through a memory barrier instruction. Implementation of Peterson's and related algorithms on processors which reorder memory accesses generally requires use of such operations to work correctly to keep sequential operations from happening in an incorrect order. Note that reordering of memory accesses can happen even on processors that don't reorder instructions
I am having trouble understanding what this means or if this is even the answer.
So, why is Peterson's solution not guaranteed to work on modern architectures ?
but if your question generally covers … a software algorithm
– Venable