In multiprocessor programming, consistency model is the key concept to express the correctness of concurrent objects ranging from simple read/write shared variable to concurrent data structures like FIFO, SkipList, etc.
I think I can understand the principle underlying consistency model when it is treated as an abstract specification of correctness. I am also able to check an execution of some concurrent object against a specific consistency model.
However, when I want to explore more about multiprocessor programming, especially when it comes to the layers of the hardware, operating system, compiler, and virtual machines (JVM, for example), I am totally confused.
At the hardware level, there is only one main memory while each processors holds its own caches. As a consequence, so called cache coherence problem arises and many protocols are proposed to address it.
What is the relation between cache coherence and consistency model?
Up to the operating system and compiler, processes are interleaved and method calls may be reordered for optimization.
Do these make consistency model indispensable?
At the programming language level, I know there is Java Memory Model and it does not enforce Sequential consistency.
What does it mean for JVM to follow some given consistency model?
In summary, what are the parts of consistency model playing in hardware, operating system, and programming language?
I don't understand the whole story and very confused.
Thank you for any suggestions and references.