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.

178<br />

| Load mo → (mo ∈ {NA, Seq cst})<br />

| Store mo → (mo ∈ {NA, Seq cst})<br />

| RMW mo → (mo ∈ {Seq cst})<br />

| Fence mo → false<br />

| Blocked rmw → true<br />

end<br />

<strong>The</strong>orem 13.<br />

(∀ opsem p.<br />

opsem assumptions opsem ∧<br />

statically satisfied tot condition opsem p −→<br />

(rf behaviour SC memory model SC condition opsem p =<br />

rf behaviour tot memory model tot condition opsem p))<br />

sc only<br />

total<br />

Equivalence proof overview<br />

This proof of equivalence is rather more involved than those that have already been<br />

presented. <strong>The</strong> form of c<strong>and</strong>idate executions differs between the two models: they have<br />

different execution witnesses <strong>and</strong> different calculated relations, so the equivalence that<br />

projectsonlyrffromtheexecutionwitnessisused. <strong>The</strong>proofreliesonseveralassumptions<br />

on the thread-local semantics that enable induction over partial executions.<br />

At the highest level, the proof involves showing that one can translate an execution<br />

from one model into an execution in the other. <strong>The</strong>se translations will rely on the absence<br />

of undefined behaviour, <strong>and</strong> are supported by complementary proofs showing that<br />

undefined behaviour in one model implies undefined behaviour in the other.<br />

<strong>The</strong> translation from a total order execution to a partial one is straightforward: each<br />

of the partial relations, lo, mo <strong>and</strong> sc is projected out of tot, <strong>and</strong> a translated execution<br />

witness gathers these translated relations together. In the other direction, a linearisation<br />

of the union of hb <strong>and</strong> sc forms the translated total order of the execution witness. <strong>The</strong>n,<br />

as we shall see in greater detail later, in the absence of faults, these translations produce<br />

consistent executions in their target models.<br />

<strong>The</strong> treatment of faults that lead to undefined behaviour forms a large part of the<br />

proof effort. <strong>The</strong> line of argument relies on the notion of a prefix, a partial execution<br />

that includes all actions that are ordered before any action within the prefix. In either<br />

direction, the general form of the proof follows the same series of steps. Given a faulty<br />

execution in one model:<br />

1. choose some order over the actions <strong>and</strong> find a minimal fault in that order,<br />

2. construct a prefix of that fault that contains no other faults,<br />

3. show that this prefix is consistent,

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

Saved successfully!

Ooh no, something went wrong!