Boost logo

Boost Users :

Subject: [Boost-users] [fiber] High CPU usage when fiber round robin sheduler is idle
From: lin li (sdeber_at_[hidden])
Date: 2016-09-26 10:59:11


Hi, guys. I have a problem with Boost fiber in 1.62 beta 2. My machine is a 4 core machine with 64bit ubuntu 14.04 installed. In my program, I created 4 kernel threads each of which uses the round robin fiber scheduler. One thread 1, I created one fiber that read data from a socket in a blocking manner. Once it got some data, it writes the data into a blocking fiber channel. For the rest thread kernel threads, I created 5 fibers for each of them. They all read (in a blocking manner) data from the same channel.

My problem is when no data is sent to the socket, and the system is idling, I can see very high CPU usage on three cores. I profiled the code, it seems to me that the kernel threads keep calling fiber scheduler to sleep then wake up again. I suspect that the time interval for the function suspend_until() may be too short. If that is the case, then how can I increase it?



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