[cpp-threads] Alternatives to SC
Alexander Terekhov
alexander.terekhov at gmail.com
Mon Jan 15 06:57:52 GMT 2007
On 1/14/07, Raul Silvera <rauls at ca.ibm.com> wrote:
[...]
> Furthermore, as several other people have mentioned already, SC requires
> reads to wait for any writes observed from other threads to become globally
> visible. This means you need a StoreLoad barrier ...
P1: x = 1;
P2: if (x == 1) y = 2;
P3: if (y == 2) assert(x == 1);
PowerPC Book II discusses that example and says that it requires
P1: x = 1;
P2: if (x == 1) sync(), y = 2;
P3: if (y == 2) sync(), assert(x == 1);
('Cumulative ordering' property of 'sync' instruction.)
I somehow doubt that it will outperform a sync()-less version doing
load of x on P3 via stwcx-validated lwarx. ;-)
regards,
alexander.
More information about the cpp-threads
mailing list