[cpp-threads] Editorial comments on the straw man

Nelson, Clark clark.nelson at intel.com
Wed Jan 18 22:18:10 GMT 2006


I don't know a lot about concurrent programming, but I do know something
about standardese. Here are some relatively high-level comments on the
overall structure of the proposal. I'm concentrating on the definitions
and how they interrelate.

In the first place, the definition of "action" needs considerable work.
"A particular program point" is not a well-defined concept. The first
question in my mind is, does a call to a user-defined function really
need to be included in the definition? Certainly there need to be
constraints on the sequencing of loads and stores resulting from the
execution of a function, but I think it's possible to do that without
including the call itself in the set of actions.

If it turns out that "action" really needs to include only memory
transactions, that presumably boils down to primitive/atomic operations,
loads (which can be defined as an lvalue-to-rvalue conversion), and
stores (which can be defined as an assignment, compound assignment,
increment or decrement).

Also presumably, a load or store will be defined as an access to a
scalar object. And the set of scalar types will probably have to be
divided into two subsets: those which do guarantee atomic access (or at
least can, for some set of operations), and those which do not provide
any guarantees of atomicity.

In passing, a low-level editorial comment: in C++ standardese, the term
"object" covers the same ground as "variable, [non-bit-field] member or
array element".

The terms "occurs before" and "happens before", and the way they are
mapped to the concepts they represent, appear (from my perspective) to
have been pulled out of a hat. Given that you're effectively trying to
replace the term "sequence point", for the intra-thread concept I'd
suggest the term "sequenced"; for example, in the expression (A, B),
every evaluation and side effect of A is sequenced before every
evaluation and side effect of B. For the inter-thread concept, how about
something like "observably sequenced", or even "inter-thread sequenced"?

Concerning "synchronizes with": It appears to have two different
informal definitions. Or is "Informally" at the beginning of the second
paragraph actually a typo? Should it be "Formally" instead?

I'm wondering about the need for spelling out the concept of
"consistent". As far as I can tell, the only way to violate consistency
would be to violate some other provision of the standard. So couldn't we
just assume it? Or am I missing some (other) important implication of
consistency?

If the concept of "consistent" is necessary, then there's a problem with
the current definition, in that it depends on the undefined term "sees".

-- 
Clark Nelson		Vice chair, J16 (ANSI C++ standard committee)
Intel Corporation
clark.nelson at intel.com



More information about the cpp-threads mailing list