2

Two observations of mine (correct me if wrong):

  • In the output of time for timing a process,

    'User' and 'Sys' come from wait (2) or times (2), depending on the particular system.

  • In Linux kernel, both the process states "running" and "ready" (i.e. runnable and waiting in run queue) are represented by TASK_RUNNING.

What process state(s) counts into the cpu time of a process:

  • "running"
  • "ready"
  • both "running" and "ready", i.e. TASK_RUNNING ?

My pick is "running". But if that is true, since TASK_RUNNING in Linux kernel doesn't distinguish between "running" and "ready", how can time report the cpu time?

0

For counting the time the important are the ticks of the processor and the ticks that the process wasted on the processor. If you're talking about the time a process spend on the processor you have to sum the ticks while running in user and kernel mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.