0

Im using a simple thread safe queue of tasks, that can be seen in this post : C Pthreads - issues with thread-safe queue implementation

When the program was only about loading the queue with a bunch of tasks and performing them concurrently, the cpu usage was well distributed between all cores as shown by htop and the monitoring system (60 ~ 70% for each core).

When i added some heavy file reading (sequentially) at the beginning of the code, and executed the exact same parallel tasks, the cpu usage got concentrated in one of the cores (100%) during all execution. Can someone help me figure out what is happening? Thanks.

Community
  • 1
  • 1
Pastel Assado
  • 19
  • 1
  • 4
  • You could have a [mcve] in **this** question because you just write your thread management in the other. Maybe, there is only one thread than consume 100% of one CPU because it has a lot to work? With htop, you could see what thread consumes CPU. – Stargateur Jan 30 '17 at 03:13
  • @Stargateu I'm asking more of a generic question that's why i didn't add the code, but i will try to do it. It's not that only one thread is consuming 100%. There's only one cpu beeing used (at 100%) when i add file reading to the code. – Pastel Assado Jan 30 '17 at 03:25

0 Answers0