Search code examples
multithreadingqnx

Thread in ready state consumes CPU


I understand that only the threads in running state actually consumes CPU but as show below by top in QNX platform, total CPU states is 99.3 which is a cumulative of four threads of which only one is in running state.

Any idea why CPU is consumed more than what running threads consume?

    CPU states: 99.3% user, 0.6% kernel
    CPU  0 Idle: 0.0% 
    CPU  1 Idle: 0.0% 
    Memory: 0 total, 1G avail, page size 4K
    PID   TID PRI STATE HH:MM:SS CPU  COMMAND
    704585 11  10  Run   0:01:52 24.82% App
    704585 10  10  Rdy   0:01:52 24.68% App
    704585 13  10  Rdy   0:01:52 24.53% App
    704585 16  10  Rdy   0:01:49 24.19% App

Solution

  • The threads that are ready were in a running state when they consumed the CPU. Given the very similar CPU values, I'll bet that all of those threads are always either ready to run or running.