Please note that the content of this book primarily consists of articles
available from Wikipedia or other free sources online. In computing, a
Memory model describes how threads interact through memory, or more
generally specify what assumptions the compiler is allowed to make when
generating code for segmented memory or paged memory platforms. The
significance of a memory model is most easily explained by referring to
languages that have no memory model. If a language has no memory model
then this prevents a compiler from performing many important
optimizations. Even simple compiler optimizations like Loop fusion move
statements in the program, and therefore influence the order of read and
write operations of potentially shared variables. If the ordering of
reads and writes changes, this can cause Race conditions. Without a
memory model, a compiler is therefore not allowed to apply such
optimizations to multi-threaded programs in general, or only in special
cases.