None
EN
Comment on Mutual Exclusion: No, You Don’t Need Atomic Operations to Build a Lock in C by Good Fences Make Great Concurrent Code: Implementing Dekker’s Algorithm on an x86/x64 Machine – Chris Feilbach's Blog
['Chris Feilbach', 'I M A Cpu Architect With A Passion For Expanding People S Knowledge About Lesser Known Areas Of Computation. I Want Software Developers', 'Especially You', 'To Use The Chips I Make To Make Your Software Run As Fast As Possible.', '.Wp-Block-Post-Author-Name Box-Sizing Border-Box', 'Sourceurl', 'Wp-Content Plugins Gutenberg-Core Build Styles Block-Library Post-Author-Name Style.Min.Css', '.Wp-Block-Post-Author-Biography Box-Sizing Border-Box White-Space Pre-Wrap', 'Wp-Content Plugins Gutenberg-Core Build Styles Block-Library Post-Author-Biography Style.Min.Css', '.Wp-Block-Comment-Author-Name Box-Sizing Border-Box']
Comments for Chris Feilbach's Blog
Both threads set their flags, both threads enter the while loop, but only the thread whose turn it is leaves. The turn variable changing when the last thread released it to the opposite thread ensures that if both threads attempt to enter again, the last thread that won that race doesn’t get to enter again. On an ARM system, it would be entirely legal for the processor to perform the other thread’s flag load (the while loop condition) before notifying the other thread it wants to enter the critical section.