dimanche 9 mai 2021

Linux: Missing threads in a process, gcore shows otherwise

I'm trying to start 20 std::threads on a quad core linux machine. I have added logs everywhere. I noticed that at the time of destruction, only 5 threads joined. So, I checked the logs present in thread function. It was printed only 5 times, which means that only 5 threads started and explains why only 5 threads joined.

But, then I took gcore of the process. It shows all 20 threads running (and waiting on a std::condition_variable). All threads are well past the thread function.

I cannot get my head around this. If OS didn't let the threads start, why are they present in process trace ? What am I missing or don't understand ?

hardware_concurrency: 4 and total threads in process: 68

This is happening everytime, and is not intermittent.

Aucun commentaire:

Enregistrer un commentaire