[fiber] High CPU usage when fiber round robin sheduler is idle
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?
2016-09-26 16:59 GMT+02:00 lin li
I suspect that the time interval for the function suspend_until() may be too short.
if you don't explicitly put a fiber to sleep (sleep_until()/sleep_for()) suspend_until() sleeps forever.
If that is the case, then how can I increase it?
you should provide simple test code that demonstrates your problem
participants (2)
-
lin li
-
Oliver Kowalke