21 Atomic access and memory consistency

 

This chapter covers

  • Understanding the “happened-before” relation
  • C library calls that provide synchronization
  • Maintaining sequential consistency
  • Working with other consistency models

We will complete this level with a description of concepts that form an important part of the C architecture model and are, therefore, a must for experienced programmers. This last section will focus on increasing your understanding of how things work, not necessarily improving your operational skills. Even though we will not go into all the glorious details,1 things can get a bit bumpy; please remain seated and buckle up.

If you review the pictures of control flow you have seen throughout the previous sections, you see that the interaction of different parts of a program execution can get quite complicated. We have different levels of concurrent access to data:

21.1 The “happened-before” relation

21.2 C library calls that provide synchronization

21.3 Sequential consistency

21.4 Other consistency models

Summary