06.08.2013 Views

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

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Release and Acquire, and Consume<br />

Recall, a release makes previous writes visible to o<strong>the</strong>r threads.<br />

A release orders memory accesses so that no preced<strong>in</strong>g write may be<br />

moved to after <strong>the</strong> release by <strong>the</strong> compiler or hardware.<br />

An acquire makes writes by o<strong>the</strong>r threads that have made a release<br />

visible.<br />

An acquire orders memory accesses so that no subsequent read or<br />

write may be moved to before <strong>the</strong> acquire.<br />

A consume is similar to an acquire but it lets unrelated reads be<br />

moved by <strong>the</strong> compiler to before <strong>the</strong> consume. In addition it can be<br />

implemented faster on some mach<strong>in</strong>es <strong>in</strong>clud<strong>in</strong>g Power.<br />

Release/acquire is different <strong>from</strong> unlock/lock but unlock/lock perform<br />

release/aqcuire <strong>in</strong> addition to keep<strong>in</strong>g track of <strong>the</strong> lock value.<br />

Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 23 / 70

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!