[cpp-threads] A niggle on the atomic model (N2145)
Nick Maclaren
nmm1 at cus.cam.ac.uk
Thu Apr 19 12:15:18 BST 2007
This is why N2145 can't be implemented in one (VERY small) detail, which
should be dropped. The problem is extending "address-free" to allow two
address values in the program (virtual addresses) to map to the same
location (physical address), and making that defined behaviour for the
atomics.
Consider an Alpha-like system (load-locked + store-conditional)
operating on an integer/point that may span two hardware memory
locations (e.g. 64-bit on a 32-bit 'bus'). One obvious code for
an atomic copy is:
if (A != B)
do {
X = load_locked(A[0]);
Y = load_locked(A[1]);
} while
store_conditional(B[0]) &&
store_conditional(B[1]);
This will loop indefinitely if A and B map to the same location, and
I can think of no way that the application can detect that, reliably
and portably, let alone for reasonable efficiency.
Can anyway see a flaw in my argument?
Regards,
Nick Maclaren,
University of Cambridge Computing Service,
New Museums Site, Pembroke Street, Cambridge CB2 3QH, England.
Email: nmm1 at cam.ac.uk
Tel.: +44 1223 334761 Fax: +44 1223 334679
More information about the cpp-threads
mailing list