|
Boost Users : |
Subject: [Boost-users] [1.48] interprocess consumes 100% on 32bit Windows systems
From: Bogdan Slusarczyk (bogdan.slusarczyk_at_[hidden])
Date: 2012-07-13 04:39:17
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net