Solaris CPU 运行队列
有没有命令可以告诉我 Solaris 运行队列中有什么? 我可以使用 vmstat 获得计数,但我需要知道其中有哪些进程/线程。
Is there a command which can tell me whats in the Solaris run queue?
I can get a count using vmstat, but I need to know what processes/threads are in there.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
运行队列总是在变化,因此几乎不可能获取当前运行队列中的进程集。
也就是说,您可以通过查看
ps
中进程列表的STAT
(状态)字段来获得近似值。运行以下命令时:...如果
STAT
字段以R
开头,则该进程被内核标记为RUNNABLE
,这在大多数操作系统上意味着它在运行队列中。以下是可运行进程在我的机器上的样子:在Solaris 上,您还可以使用
prstat
命令并查看STATE
列。值run
表示该进程位于运行队列中。 (另请注意,值cpuN
表示该进程当前正在处理器 N 上运行。例如:
The run-queue is always changing, so it's almost impossible to get the set of processes in the current run-queue.
That said, you can get an approximation by looking at the
STAT
(state) field of the process list fromps
. When running the command below:...the if the
STAT
field begins withR
, then the process is markedRUNNABLE
by the kernel, which on most operating systems means that it is in the run-queue. Here's what a runnable process looks like on my machine:On solaris, you can also use the
prstat
command and look at theSTATE
column. The valuerun
indicates that the process is on the run-queue. (Also note that the valuecpuN
indicates that the process is currently running on processor N.For example:
当我看到你已经这样做时,我正要纠正 0xfe 答案。运行队列包含不进程的ads,因此如果您希望“状态运行”行的数量或多或少与运行队列匹配,则 prstat 命令必须使用 -L 选项。请注意,采样工件可能会妨碍获得准确的匹配。
无论如何,如果您想准确地知道运行队列中有哪些进程/线程,您宁愿采用 dtrace 方式(假设您运行的是 Solaris 10 或更高版本)。
whoqueue.d 脚本可能已经位于您计算机上的 /usr/demo/dtrace 目录中,这将是一个好的开始:
查看 此页面了解详细信息。
I was about to correct 0xfe answer when I saw you already did it. The run queue is containing theads not processes so the -L option is mandatory with the prstat command if you want to have the number of "state run" lines more or less matching the run queue. Beware that sampling artifacts will probably prevent to get accurate matches.
In any case, if you want to precisely know what processes/threads are sitting in the run queue you'd rather go the dtrace way assuming you are running Solaris 10 or newer.
The whoqueue.d script which might already been in /usr/demo/dtrace directory on your machine will be a good start:
Have a look at this page for details.