What is the Use of ‘volatile’ in C Language?

What is the Use of 'volatile' in C Language?

Hello everyone, I am Xiao Feng Ge. When learning C language, there is a strange keyword volatile, what is its use? volatile and the Compiler First, let’s look at this piece of code: int busy = 1; void wait() { while(busy) { ; }} Compile it, and note that O2 optimization is used here:Let’s take … Read more

What is the Use of ‘volatile’ in C Language?

What is the Use of 'volatile' in C Language?

Code Xiaobian MillionFans CertifiedAccount By clicking follow, you not only gain a tool for finding resources but also an interesting soul ▶ ▶ ▶ When learning C language, there is a strange keyword ‘volatile’. What is its use? volatile and the Compiler First, let’s look at this piece of code: int busy = 1; void … Read more

ARMv8/ARMv9 Memory Barrier Mechanism (Observer & Barrier)

ARMv8/ARMv9 Memory Barrier Mechanism (Observer & Barrier)

ver0.3 Introduction Those who have persisted in reading this article are already remarkable, as they now understand the weak memory ordering architecture of ARM. You not only understand the types of memory, the memory sharing mechanisms, and the memory consistency mechanisms, but also the CPU architecture and the microarchitecture of processors, all of which lay … Read more

The Theory of Linux Memory Barriers and Five Practical Applications (Based on ARM64)

The Theory of Linux Memory Barriers and Five Practical Applications (Based on ARM64)

There is a saying in the community: “Cherish life, stay away from barriers,” which sufficiently illustrates that memory barriers are quite obscure and difficult to grasp accurately. Using too weak a barrier can lead to software instability, while using too strong a barrier can cause performance issues. Therefore, in engineering, the goal is to pursue … Read more