Click here to Skip to main content
15,910,981 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can I learn the status of a process (sleeping, running or ready.)
Posted
Updated 22-Dec-11 7:43am
v3

1 solution

TASK_RUNNING task (process) currently running
TASK_INTERRUPTABLE process is sleeping but can be woken up (interrupted)
TASK_UNINTERRUPTABLE process is sleeping but can not be woken up (interrupted)
TASK_ZOMBIE process terminated but its status was not collected (it was not waited for)
TASK_STOPPED process stopped by a debugger or job control
TASK_SWAPPING (removed in 2.3.x kernel)

The Life Cycle of Processes

"The /proc/pid/sched file contains a metric ton of scheduling data.I suggest reading through the /proc/*/sched files looking for se.statistics.nr_wakeups or se.statistics.wait_count lines that don't change for an hour. I don't know off-hand which one would give you 'better' results, but try both :) and see which one gives you answers like you expect." ref.

and another link:
Get Process Status

[UPDATED]
Running :
if you read through the /proc/*/sched files looking for se.statistics.nr_wakeups or se.statistics.wait_count lines that changes shortly that means its running.
Sleeping:
if you read through the /proc/*/sched files looking for se.statistics.nr_wakeups or se.statistics.wait_count lines that don't change for an hour that means its sleeping.
 
Share this answer
 
v2
Comments
merturk 22-Dec-11 14:21pm    
is there a way learning from terminal? I need to it to make a project? at your link there is something abput processes but it doesn't say anything if they are running or sleeping.
Sergey Alexandrovich Kryukov 22-Dec-11 14:32pm    
Nice answer, my 5.
--SA
Monjurul Habib 22-Dec-11 14:39pm    
thank you
thatraja 22-Dec-11 14:49pm    
5!
Monjurul Habib 22-Dec-11 14:51pm    
thank you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900