Re:Distributed systems in an alternative universe
by Rusky on Wednesday March 09, 2016 @01:00PM
(#11254511)
Wouldn't globalFlag just be shared in a duplicated cache line between all cores until one of them modifies it?
[ Parent
| on HN ]
Re:Distributed systems in an alternative universe
by scott_s on Wednesday March 09, 2016 @02:30PM
(#11255163)
If the code was:
while (globalFlag) {
++someValue;
}
Then you'd probably be okay. But calling a function which does some lightweight but non-trivial work will interfere with your cache. When you come back from the stack frame for doSomeLightWork(), you're more likely to need to load globalFlag from memory.In a multithreaded application where you want to scale to dozens or even hundreds of threads, you have look at even global memory accesses as communication.
Re:Distributed systems in an alternative universe
by Rusky on Wednesday March 09, 2016 @05:07PM
(#11256063)
That still doesn't sound like the cache line "bouncing around" any more than it would if a single-core app did the same work. There's no contention on it the way there would be on a shared mutable value, at least.