As a developer, we have seen how synchronized blocks and methods can ensure that operations execute atomically, but unfortunately, it is a common misconception that synchronized is not only about atomicity or demarcating “critical sections”. Synchronization also has another important aspect, mainly memory visibility. We want not only to prevent…