在* nix中,是什么原因导致“睡眠"?在最高指挥? [英] In *nix, what causes "sleeping" in top command?

查看:86
本文介绍了在* nix中,是什么原因导致“睡眠"?在最高指挥?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是什么原因导致我在top中看到的这些sleeping进程?如果我要调用PHP的sleep()函数,那会增加我在top中看到的sleeping计数吗? sleeping中的高位数是否有任何不利之处?

What causes these sleeping processes that I see in top? If I were to call PHP's sleep() function, would that add to the sleeping count I see in top? Are there any disadvantages to having a high number in sleeping?

推荐答案

进程被阻塞时正在休眠,正在等待某些东西.例如,它可能已调用read(),并且正在等待数据从网络流中到达.

A process is sleeping when it is blocked, waiting for something. For example, it might have called read() and is waiting on data to arrive from a network stream.

sleep()确实是使进程休眠一段时间的一种方法.但是,休眠是除受计算密集的所有进程之外所有进程的正常状态-休眠本质上是进程在不执行任何其他操作时所执行的操作.这是大多数进程处于休眠状态的正常状态-如果不是 情况,则表明您需要更多的CPU功能.

sleep() is indeed one way to have your process sleep for a while. Sleeping is, however, the normal state of all but heavily compute-bound processes - sleeping is essentially what a process does when it isn't doing anything else. It's the normal state of affairs for most of your processes to be sleeping - if that's not the case, it tends to indicate that you need more CPU horsepower.

这篇关于在* nix中,是什么原因导致“睡眠"?在最高指挥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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