[cpp-threads] pthreads (was: RE: C++ Connections proposal)

Peter Dimov pdimov at mmltd.net
Tue Apr 26 12:58:41 BST 2005


Boehm, Hans wrote:
> That's what I meant.  I hadn't seen that discussion.

[...]

>>> For details, see my upcoming PLDI paper, which, as of five minutes
>>> ago, is cited from the page at
>>>
>>> http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/
>>
>> I suppose you mean ``Threads Cannot Be Implemented As a
>> Library'', HP Labs Technical Report HPL-2004-209, to appear,
>> PLDI 2005.

I've read your paper, and I feel like I'm missing something fundamental, 
probably because I lack the necessary background. I just can't understand 
who is the intended audience, or why such a paper is needed.

Is someone really arguing that threading is possible without cooperation 
from the compiler?

Why is:

if (x == 1) ++y;
if (y == 1) ++x;

an interesting example, given that it is composed entirely of unlabeled (and 
hence, non-competing) accesses and the compiler is free to do whatever it 
likes?

"Consider the sequence

x = 1;
pthread_mutex_lock(lock);
y = 1;
pthread_mutex_unlock(lock);

Some implementations of pthread mutex lock() only in-
clude a one-way "acquire" barrier. Thus the above may be
executed as

pthread_mutex_lock(lock);
y = 1;
x = 1;
pthread_mutex_unlock(lock);"

Why is this relevant once lock-free enters the picture? "x = 1" is a 
non-competing access, and lock-free code doesn't use non-competing accesses.

I'll read the paper again. :-)





More information about the cpp-threads mailing list