The meaning of Tasks and Running in htop screen

cpuhtopprocess

On my computer it shows

Tasks 314; 24 running

What do these numbers mean?

Is 1 Task = 1 process?

Why isn't the number of running tasks = number of CPUs then? (I have more than 24 CPUs)

edit. sometimes the number before "running" actually exceeds the number of CPUs I have!

Best Answer

Tasks do represent the number of opened processes. (Note that I do not use the term "running" to avoid confusion.)

You have to realize that not all opened processes consume CPU constantly.

Each process can be in a number of different states:

  • running: actively using CPU
  • stopped: the process was stopped (paused) by the user
  • defunc or zombie: process is actually blocking on an external resource, commonly a disk drive
  • sleeping: most common state as many processes actually sleep a lot of the time and do small checks at different intervals, or wait for user input