Using hpx::thread::sleep_for(1s) results in CPU utilization reaching 80% #6470
-
Using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
HPX, on its default configuration, spawns one OS thread for each core in your machine as soon as the runtime is initialized. These worker threads are constantly checking for available work (literally on a while loop, see here). On the hpx::thread::sleep_for(), this will only suspend the current "HPX-thread", which is more like a user-space task. If you are interested in pausing the HPX runtime, this is described here. |
Beta Was this translation helpful? Give feedback.
HPX, on its default configuration, spawns one OS thread for each core in your machine as soon as the runtime is initialized. These worker threads are constantly checking for available work (literally on a while loop, see here).
That explains the high utilization. The worker threads will eventually automatically suspend when there is no work. This can be controlled using the hpx.max_idle_backoff_time configuration value.
On the hpx::thread::sleep_for(), this will only suspend the current "HPX-thread", which is more like a user-space task. If you are interested in pausing the HPX runtime, this is described here.