29.11.2015 Views

The C11 and C++11 Concurrency Model

1ln7yvB

1ln7yvB

SHOW MORE
SHOW LESS

Create successful ePaper yourself

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

227<br />

• scC(client(X))∪scL(lib(X)) is acyclic.<br />

Proof Sketch It is straightforward that client(X) <strong>and</strong> lib(X) satisfy Noninterf. Furthermore,<br />

any cycle in scC(client(X))∪scL(lib(X)) is also a cycle the original execution,<br />

<strong>and</strong> this contradicts the consistency of SC.<br />

To check 8.1 (8.2 is similar), we need to show that the client projection of the happensbefore<br />

edges in X match the happens-before relation created by the most general-client<br />

execution of the client extended by the library core guarantee. Note that the MGC<br />

happens-before is certainly a subset, so it remains to show that any happens-before edge<br />

in client(X) is also an edge in an execution of the most general client. Consider an<br />

arbitrary edge between actions u <strong>and</strong> v. <strong>The</strong> happens-before edge is made up of a path<br />

in sb <strong>and</strong> sw. All interface actions on the same thread are related by sequenced before,<br />

so we can pick out all interface actions in this path. Synchronisation is only ever created<br />

between actions at the same location, so non-interference implies that there is never a<br />

synchronises-with edge between the two components. Together that implies that any<br />

segment of library actions in the path of edges from u to v starts with a call action <strong>and</strong><br />

ends with a return action, <strong>and</strong> is covered by the history, as required.<br />

It is clear that the most general client will generate pre-executions that cover the<br />

projections in each case above. Any subset of the actions of an execution together with<br />

the relations restricted to that set will satisfy most of the conjuncts of the consistency<br />

predicate, with those conjuncts that deal with locks, <strong>and</strong> read values implied by noninterference.<br />

Because X satisfies non-interference, any safety violation must either be a data race,<br />

an indeterminate read or an instance of bad mutex use. In the racy case, again because<br />

of non-interference, both racy actions must be in the same component, as required, <strong>The</strong><br />

mutex case is similar. Indeterminate reads are a single action fault, so they reside in one<br />

component or the other.<br />

Lemma 23 (Composition). Consider<br />

X ∈ C, hbL(core(Y))I;<br />

Y ∈ L 2 , hbC(core(X))I 2 ,<br />

such that<br />

• A(X)∩A(Y) = interf(X) = interf(Y) <strong>and</strong> otherwise action <strong>and</strong> atomic section identifiers<br />

in A(X) <strong>and</strong> A(Y) are different;<br />

• interf(sb(X)) = interf(sb(Y));<br />

• scC(X)∪scL(Y) is acyclic; <strong>and</strong><br />

• X <strong>and</strong> Y satisfy Noninterf.

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

Saved successfully!

Ooh no, something went wrong!