HN2new | past | comments | ask | show | jobs | submitlogin

But Peterson's algorithm requires explicit memory barriers even on x86, it doesn't seem the best example to show the difference.


Here are my slides from back then: https://reinference.net/mp-talk.pdf

You made me wonder, because I definitely remember using Peterson's Algorithm, so I went back to my slides and turns out: I first showed the problem with x86, then indeed added an MFENCE at the right place, and then showed how that was not enough for ARM. So the point back then was to show how weaker memory models can bite you with the example of x86, and then to show how it can still bite you on ARM with its even weaker model (ARMv7 at that time, and C11 atomics aren't mentioned yet either, but their old OS-specific support is).


Damn, my knowledge of ARM and x86 memory models was limited to "x86 provides a stronger model" but that was it. So much to learn, thanks for the slides.


Oh, right, yes, ARM additionally needs a release barrier on the unlock path.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: