[cpp-threads] Alternatives to SC

Doug Lea dl at cs.oswego.edu
Sun Jan 14 16:00:12 GMT 2007


Peter Dimov wrote:
> Doug Lea wrote:
> 
>> Atomics can be used to create SC constructions like locks.
>> But atomics can also be used in other ways that are not necessarily
>> SC. As it turns out, all usages on cache-coherent causally consistent
>> machines are at least nearly SC.
> 
> Isn't it true that most usages are PC? 

At least some versions of PC (Program consistency) are among
those models that might, under the right interpretation, be
equivalent to CCCC. I have a list of five in this category.
The main reason for taking the risk to name yet another memory
model is that none of them seem to bear uncontroversial interpretations
that would allow clear use as language-level memory model.

>  Do we really need the #StoreLoads? :-)
> 

Not necessarily. I'm taking first things first though. Get the "strongest"
semantics down, and then show how other read/write operations
can be treated as various forms of weakenings (or equivalently,
the introduction of within-processor parallelism).

> Speaking of hazard pointers... as an aside, the two main problems with 
> turning an academic paper into a real C++ implementations are that (1) 
> most papers assume SC when giving the pseudocode, (2) most papers either 
> assume garbage collection, or don't mention the issue of memory 
> management at all. Even given SC atomics, the second problem remains. 
> Yet the discussion doesn't mention it at all. Do the proponents of "SC 
> atomics for the masses" also assume that they will only be usable in a 
> GC environment? :-) I simply don't see how a non-expert can reasonably 
> handle the memory management of a typical lock-free container, no matter 
> how sequentially consistent the atomics are.
> 

Continuing your aside-mode: I agree that for C++, it would be great
to have a pre-supplied library component or two to handle hazard
pointers, because they are very hard to program. And secondarily
because vendors might be able to supply special versions that exploit
platform-level tricks (like cheats relying on pointer representations).
Maybe you could propose a little API for these?

-Doug




More information about the cpp-threads mailing list