Pass 2.3

Andrei Alexandrescu andrei at metalanguage.com
Sat Sep 11 03:12:53 BST 2004


Oh, thanks. I also added one more paragraph in the "Extra writes" 
section, reintroducing the word tearing theme. Let me know if that's cool:

Another instance of this problem is with hardware that doesn't support 
memory writes below a certain size (often, \verb|sizeof(int)|). In 
that case, if \verb|S| is ``packed'' such that \verb|sizeof(S) == 
sizeof(int)|, the compiler must generate code for \verb|s.a = 0| to 
read the entire \verb|s| object in a register, mask a portion of it, 
and write back the entire object to memory. Effectively, simply 
writing the the field \verb|S::a| became a read-modify-write operation 
as far as the neighboring fields \verb|S::b| and \verb|S::c| are 
concerned---operation that has racing problems if the operation is not 
atomic, and efficiency problems if it is not.



Andrei

Boehm, Hans wrote:
> Looks good.  But I think the comparison in "Fun" is backwards.  Delete the return and reindent.
> 
> Minor point for future discussion:
> If you implement atomics with private locks, you also need to disable signals.  (Atomic_ops can do this as a last resort.)  It may be cheaper to just do the emulation in the kernel.  I dimly recall that this was done for AIX on Power a long time ago.
> 
> Hans
> 
> 
>>-----Original Message-----
>>From: Andrei Alexandrescu [mailto:andrei at metalanguage.com]
>>Sent: Friday, September 10, 2004 4:33 PM
>>To: Kevlin Henney
>>Cc: Doug Lea; Boehm, Hans; 'Ben Hutchings'; Doug Lea; pugh at cs.umd.edu
>>Subject: Re: Pass 2.3
>>
>>
>>Ok, I've made a quick pass, put some pizzazz in, etc. If anyone could 
>>give it a read and comment on it, that would be great. Thanks!
>>Andrei
>>P.S. If you want to compile the doc, you'll need the listings package.
>>






More information about the cpp-threads mailing list