Skip to content

Comment on Memory Reordering Caught in the Act

Comments

I hope this isn't too dumb, but I always imagined each processor having its own set of registers.

Am I incorrect? I can't see how multiple processors can share registers without chaos?

The registers aren't shared here, but the main memory is. The example has each thread write '1' into a [shared, main] memory location and then read the other thread's memory location into a register. If both CPUs' registers are 0, that means that both reads occurred before both writes.

Of course they have different registers, but they sure don't have different memory.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.