In my C++ program, I am using boost
libraries for parallel programming. Several threads are made to join()
on other threads in a part of the program.
The program runs pretty slow for some inputs... In an attempt to improve my program, I tried finding hotspots using Intel VTune
. The most time-consuming hotspot is shown to occur due to boost::this_thread::interruptible_wait
:
When I checked the portion of the source code where this hotspot occurs, it shows the call to join()
. I was under the impression that waiting threads do not take CPU Time. Can someone help me understand why does the thread join()
operation take up so much CPU time?
Any insights on how to fix such a hotspot will be very helpful too! One way I can think of to fix such a hotspot would be to somehow detach()
the threads and not join()
them.
Thanks in advance!