[Boost-users] [1.48] interprocess consumes 100% on 32bit Windows systems

2 views
Skip to first unread message

Bogdan Slusarczyk

unread,
Jul 13, 2012, 4:39:17 AM7/13/12
to boost...@lists.boost.org
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 mailing list
Boost...@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply all
Reply to author
Forward
0 new messages