cong
cong

Reputation: 1187

How compiler and processor optimization works to speed up code execution?

In Linux Kernel Development (3rd Edition), Kernel Synchronization Methods, Ordering and Barriers. There is an example:

enter image description here

And I'm confused about the statement in this book:

Again, without memory barriers, it would be possible for b to be set to pp before pp was set to p.

So, does the author mean if there is no read_barrier_depends(), b = *pp would be executed before pp = p? How could this be possible?

Upvotes: 0

Views: 84

Answers (1)

Marco van de Voort
Marco van de Voort

Reputation: 26371

I was interested in your problem, so I searched a bit longer. I found the post of the read_barrier_depends functionality on the kernel list, with some explanation:

https://lwn.net/Articles/5159/

Upvotes: 1

Related Questions