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.

Conflict<strong>in</strong>g Expression Evaluations<br />

Two expression evaluations conflict if <strong>the</strong>y access <strong>the</strong> same memory<br />

location and at least one of <strong>the</strong>m modifies that location.<br />

For example:<br />

// Thread 1 // Thread 2<br />

a = b + c;<br />

d = a + 1;<br />

An assignment is an expression so <strong>the</strong> code above conflict.<br />

By evaluation is meant that <strong>the</strong> expressions are computed at runtime.<br />

Conflict<strong>in</strong>g evaluations are necessary <strong>in</strong> parallel programs unless each<br />

thread can work exclusively on its own data.<br />

Conflict<strong>in</strong>g evaluations become a big problem if <strong>the</strong>y are not ordered<br />

through <strong>the</strong> happens before relation.<br />

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

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

Saved successfully!

Ooh no, something went wrong!