Using HPX's mutex and condition_variable leads to 99% CPU usage #6545
Unanswered
phil-skillwon
asked this question in
Q&A
Replies: 1 comment
-
The HPX synchronization primitives ( For this reason, the CPUs are still utilized 100% as the kernel threads that run the scheduling loop for HPX threads keep churning along. If you want to reduce CPU utilization in case if no HPX work is available and ready to run, you can use
first thing inside |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
My application is based on the HPX runtime, and I have set these two configuration options:
I used HPX-provided
mutex
andcondition_variable
to protect shared data, which is astd::queue<std::vector<std::byte>>
. I created two HPX threads, with thread A as the producer and thread B as the consumer. Thread A reads data from PCIe-based XDMA and pushes it to the queue, then callscondition_variable::notify_one
. Thread B calls my customread
function to read data from the shared queue within a specified timeout.Here's how my custom
read
function looks:During testing, I noticed that even when the shared queue is empty, using
mutex
orcondition_variable
causes all CPU cores to reach 99% utilization.I’ve encountered a similar issue before where using
hpx::thread::sleep_for(1s)
caused CPU usage to hit 80%. #6470Is this behavior normal? I want to achieve minimal CPU usage when using
mutex
andcondition_variable
.Beta Was this translation helpful? Give feedback.
All reactions