Threads in the new ISO C Standard from 2011
Threads in the new ISO C Standard from 2011
Threads in the new ISO C Standard from 2011
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Store<br />
Store relaxed st<br />
Store release lwsync;st<br />
Store seq cst hwsync;st<br />
1 It’s easier to program under sequential consistency!<br />
2 Yes, but, why would you want to use synchronization <strong>in</strong>structions<br />
before every store <strong>in</strong> a critical section s<strong>in</strong>ce nobody should look at <strong>the</strong><br />
data before you have left <strong>the</strong> critical section anyway?<br />
3 Write buffer<strong>in</strong>g permitted by store relaxed allows <strong>the</strong> mach<strong>in</strong>e to<br />
pipel<strong>in</strong>e all <strong>the</strong> stores <strong>in</strong> <strong>the</strong> critical section.<br />
4 At <strong>the</strong> end of <strong>the</strong> critical section you use store release and wait for <strong>the</strong><br />
rema<strong>in</strong><strong>in</strong>g preced<strong>in</strong>g stores (now possibly wait<strong>in</strong>g <strong>in</strong> a write buffer) to<br />
complete (i.e. <strong>in</strong>validate <strong>the</strong> o<strong>the</strong>r copies if <strong>the</strong>re are any left).<br />
Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 59 / 70