27 Feb
2009
27 Feb
'09
10:26 a.m.
will it work reliably on a multi-core machine? When the mutex unlock() happens, does that flush the CPU cache and write the value of s.qty to main memory? Does the mutex lock() operation clear the CPU cache and force a reload of s from the main memory? I'm trying to understand how synchronization works among multiple cpus.
I've only worked on multithreaded code in Java and there the memory model is well defined. AFAIK, that isn't the case in C++.
I have never encountered a C/C++ thread library which would not reliably work on multi core systems. libpthread works well and I assume boost uses libpthread as underlying base (at least on unix based systems).