What’s memory coherence?

Print anything with Printful



Memory consistency is a problem on multicore computers when multiple processors access the same memory sector, causing conflicting versions of memory. Consistency rules prevent this issue, but programmers must tailor their code to the specific rules used.

Memory consistency is a problem that occurs in a computer when a processor tries to examine a sector of memory. This problem occurs only on multicore systems or computers that have multiple central processing units (CPUs). When multiple processors look at the same memory sector and one updates the sector, the other may be left with an older version of the computer’s memory. To address this issue, consistency rules are used to ensure that processors do not access the same memory or that updates are consistent with each other. There are different consistency models, so programmers and computer developers need to know the exact model used.

The memory consistency issue only occurs on computers that use at least two CPUs due to the way they access memory. When a CPU accesses a sector of memory, it is able to take, use and alter the memory without any conflict, because there are no other hardware components competing for memory. If two CPUs are used, the two CPUs can acquire the same memory sector. While there is no problem with the two CPUs sharing memory, there is a problem if one CPU upgrades memory. This leaves the second CPU with stale memory which, if left unchecked, can cause your entire computer to have two separate and conflicting versions of computer memory.

There are programming schemes made specifically to fix memory consistency, which can be a big deal. They are collectively known as memory consistency rules, and there are many versions of them. Overall, each version tells multiple CPUs how to properly share computer memory without causing the memory consistency problem. This can be done by updating both versions of memory when one version changes or by preventing CPUs from accessing the same memory at the same time.

While using consistency rules helps avoid the memory consistency problem, another problem arises. Each consistency set has different programming and different rules, so programmers who build programs or write code that deal directly with CPUs will need to tailor the coding to the exact consistency rules. Otherwise, this may override the consistency or cause a serious conflict between the programmer’s coding and the consistency rules, and the computer may stop working.




Protect your devices with Threat Protection by NordVPN


Skip to content