I am reading "Linux Kernel Development". It has definition about "TASK_RUNNING"
"TASK_RUNNING—The process is runnable; it is either currently running or on a runqueue waiting to run". My question is why don't we have two separate state for "currently running" and "on a runqueue waiting to run". Like TASK__RUNNING and TASK_READYTORUN.
1) because when I first look at word "TASK_RUNNING", I thought it just refers to a running process state 2) more exact definition would avoid many troubles
So do we have strong reasons not to do this ??
1 Answer
The process is runnable.
Futher state separation has no sence from the view of users of this field.
Because users of that state are not interact with a scheduler, knowing whether a process is scheduled or not is useless: immediately after you obtain that knowledge, the scheduler may change that property, so your knowledge becomes invalid.
As for name TASK_RUNNING, only Linux developers knows why it is choosen. It could be historic reason, or intentionally: "Think of the process as if it is running."