Hi, I use ubuntu build from this page http://elinux.org/BeagleBoardUbuntu
When I create multiple threads with infinite loop(with sleep 10ms) by std::thread - cpu load is too high.
For example I create 21 thread like this
`
void test_class::foo()
{
while (true)
{
}
}
`
and got cpu load about 40% !!! I’m new in beagle bone, so my questions: It’s normal? What i do wrong?
Hi, I use ubuntu build from this page http://elinux.org/BeagleBoardUbuntu
When I create multiple threads with infinite loop(with sleep 10ms) by std::thread - cpu load is too high.
For example I create 21 thread like this
`
void test_class::foo()
{
while (true)
{
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
}
`
and got cpu load about 40% !!! I’m new in beagle bone, so my questions: It’s normal? What i do wrong?
My guess is that if you increased the sleep time, the cpu load would decrease significantly. The time to schedule each thread is probably significant compared to your sleep time, so when you run 21 threads, the processor is doing nothing more than rescheduling your threads. The cpu load of 40% sounds about right.
Regards,
John