进程状态(睡眠,运行,就绪) [英] process status (sleep, run ,ready)

查看:405
本文介绍了进程状态(睡眠,运行,就绪)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何了解进程的状态(正在睡眠,正在运行或就绪.)

how can I learn the status of a process (sleeping, running or ready.)

推荐答案

TASK_RUNNING 任务(进程)当前正在运行
TASK_INTERRUPTABLE 进程正在休眠,但可以唤醒(中断)
TASK_UNINTERRUPTABLE 进程正在休眠,但无法唤醒(中断)
TASK_ZOMBIE 进程终止,但未收集其状态(未等待)
TASK_STOPPED 进程被调试器或作业控件停止
TASK_SWAPPING (已在2.3.x内核中删除)

流程的生命周期

"/proc/pid/sched文件包含一吨的调度数据.我建议通读/proc/*/sched文件,查找不存在的se.statistics.nr_wakeups或se.statistics.wait_count行"不用花一个小时.我不知道哪个能给您更好"的结果,但是请同时尝试:)并看看哪个能给您满意的答案." 参考.

和另一个链接:
获取流程状态

[更新]
正在运行:
如果您通读/proc/*/sched文件以查找se.statistics.nr_wakeupsse.statistics.wait_count行,这些行不久就会发生变化,这意味着其正在运行.
睡觉:
如果您通读/proc/*/sched文件以查找se.statistics.nr_wakeupsse.statistics.wait_count行,它们在一个小时内都没有变化,则表示其处于休眠状态.
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.


这篇关于进程状态(睡眠,运行,就绪)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆