Assumption
My assumption is what I myself consider fact based on my understanding:
- Tasks in either TASK_INTERRUPTIBLE and TASK_UNINTERRUPTIBLE state are not "runnable". As such, they are not considered by the scheduler when it picks the next task to run (ref Linux Kernel Development chap 4].
- TASK_UNINTERRUPTIBLE only differs from TASK_INTERRUPTIBLE in that a signal such as SIGTERM does not affect the former.
- This means that TASK_UNINTERRUPTIBLE/TASK_INTERRUPTIBLE should not consume CPU time at all.
What I've seen people talking
- https://stackoverflow.com/questions/223644/what-is-an-uninterruptible-process
- https://superuser.com/questions/791840/how-can-a-process-in-interruptible-sleep-state-use-100-cpu
Many comments/answers in two links above said that:
- TASK_UNINTERRUPTIBLE can't be affected by SIGNAL (such as SIGTERM).
- The task must run to finish and shouldn't be interrupted, as in the case with a "quick" disk I/O (as opposed to "slow" I/O with things like tty).
Only one answer (the second link) explicitly said that UNINTERRUPTIBLE tasks consume CPU in that "the CPU is stuck" because the task can't be affected by a SIGNAL.
Question
- Does an uninterruptible task consume CPU?
- If it does, then it's contradictory with my assumption. Which of my assumption is wrong?