
13 Jul
2012
13 Jul
'12
2:39 a.m.
Hi All, I found such problem: N+1 (where N is number of cpu cores) processes with interprocess syncing use 100% cpu on 32 bit Windows system. Cause of bug: https://svn.boost.org/trac/boost/changeset/74110 void sched_yield() -{ Sleep(1); } +{ + if(!SwitchToThread()){ + Sleep(1); + } Test case: #include <windows.h> #include <iostream> int main() { int i = 0; while( true ) { if ( !SwitchToThread() ) { std::cout << "sleep" << i++ << std::endl; Sleep(1); } } } On 32 bit windows system running this in N+1 separate processes will stop printing and use 100% CPU. On 64 bit system for any number of processes printing will not stop. Kind regards, Bogdan