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.

22<br />

by Dubois et al. [48]. C/<strong>C++11</strong> coherence matches the coherence property of Censier<br />

<strong>and</strong> Feautrier [42] <strong>The</strong> compare <strong>and</strong> swap feature of C/<strong>C++11</strong> follows the IBM 370 instruction<br />

[44]. C/<strong>C++11</strong> provides racy programs with undefined behaviour, a concept<br />

borrowed from Adve, Gharachorloo <strong>and</strong> Hill [12, 10, 11] who defined memory models with<br />

stronger guarantees for race-free programs. <strong>The</strong> C/<strong>C++11</strong> memory model builds upon a<br />

simple precursor model, defined by Boehm <strong>and</strong> Adve [37], who expressed the high-level<br />

design intent of the memory model (that race-free programs using only the SC atomics<br />

should behave in an SC manner), <strong>and</strong> proved this property of their memory model.<br />

<strong>The</strong> C/<strong>C++11</strong> memory model is expressed in an axiomatic style: the model is made<br />

up of a predicate that decides whether a particular whole execution is allowed for a<br />

given program, or not. <strong>The</strong>re are several examples of early axiomatic memory models, by<br />

Collier [43], by Kohli et al. [13], <strong>and</strong> by Adve et al. [12, 10]. Contrast this with operational<br />

memory models, where the model is described as an abstract machine, with a state made<br />

up of buffers <strong>and</strong> queues. Many formal hardware memory models adopt the operational<br />

style [97, 71, 99, 91, 104], because hardware architecture specifications are often described<br />

in terms of an abstract machine.<br />

<strong>The</strong>rearemanyformalmemorymodelsofhardwarearchitectures. Sarkaretal. created<br />

an operational formalisation of the x86 architecture’s memory model [99], following the<br />

incomplete <strong>and</strong> ambiguous published specification documents of the time. This model<br />

was superseded by the operational x86-TSO model of Owens et al. [91, 104], which is easy<br />

to underst<strong>and</strong> <strong>and</strong> is validated both by discussion with Intel <strong>and</strong> by hardware testing. We<br />

describe this model in Chapter 2, <strong>and</strong> refer to it throughout this thesis. In a suggested<br />

extensiontothearchitecture, Rajarametal. proposeahardware-optimisedversionof<strong>C11</strong><br />

read-modify-write operations on x86, including an alternative compilation scheme that<br />

preserves the semantics of the language over systems using the optimised variants [93].<br />

For the x86-TSO memory model, Owens provides a stronger alternative to the typical<br />

SC-if-data-race-free guarantee, introducing triangular-race-freedom [89].<br />

<strong>The</strong>re are several formal Power memory models to note. Chapter 2 outlines the operational<br />

model of Sarkar et al. [97, 71] that was developed together with Williams, a<br />

leading processor designer at IBM, <strong>and</strong> was systematically tested against hardware. This<br />

model can claim to match the architectural intent of the vendor. <strong>The</strong> axiomatic models<br />

of Alglave et al. [14] are informed by systematic testing of hardware, with tests generated<br />

by the Diy tool [16], executed on current hardware with the Litmus tool [17], <strong>and</strong><br />

executed according to the model with the Herd tool [18]. This systematic testing led<br />

to the discovery of a bug in the Power 5 architecture [16]. Mador-Haim et al. present<br />

an axiomatic model [68] that is intended to be abstract <strong>and</strong> concise, while matching the<br />

relatively intricate model of Sarkar et al.<br />

<strong>The</strong>re is an earlier body of work on the Java memory model (JMM), another relaxedmemory<br />

language, with a rather different design (discussed in Section 5.10.3). Manson<br />

et al. provided a formal description of the official JMM [70]. Cenciarelli et al. provided a

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

Saved successfully!

Ooh no, something went wrong!