linux /proc/loadavg

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11987495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:05:24  来源:igfitidea点击:

linux /proc/loadavg

linux

提问by Ulterior

When issueing this command from linux:

从 linux 发出此命令时:

# cat /proc/loadavg
0.75 0.35 0.25 1/25 1747

What are the last 2 numbers?

最后2个数字是多少?

The last one keeps increasing by 2 every second, should I be worried?

最后一个每秒增加2个,我应该担心吗?

采纳答案by auselen

Last one is the system's workload for last 15 minutes.

最后一个是系统过去 15 分钟的工作负载。

/proc/loadavg

/proc/loadavg

The first three fields in this file are load average figures giving the number of jobs in the run queue (state R) or waiting for disk I/O (state D) averaged over 1, 5, and 15 minutes. They are the same as the load average numbers given by uptime(1) and other programs.

The fourth field consists of two numbers separated by a slash (/). The first of these is the number of currently executing kernel scheduling entities (processes, threads); this will be less than or equal to the number of CPUs. The value after the slash is the number of kernel scheduling entities that currently exist on the system.

The fifth field is the PID of the process that was most recently created on the system.

此文件中的前三个字段是平均负载数字,它给出了运行队列(状态 R)或等待磁盘 I/O(状态 D)中的作业数平均超过 1、5 和 15 分钟。它们与 uptime(1) 和其他程序给出的平均负载数相同。

第四个字段由用斜杠 (/) 分隔的两个数字组成。其中第一个是当前正在执行的内核调度实体(进程、线程)的数量;这将小于或等于 CPU 的数量。斜线后面的值是系统上当前存在的内核调度实体的数量。

第五个字段是最近在系统上创建的进程的 PID。

回答by Ulterior

The first three columns measure CPU and I/O utilization of the last one, five, and 15 minute periods. The fourth column shows the number of currently running processes and the total number of processes. The last column displays the last process ID used.

前三列测量最后一分钟、五分钟和 15 分钟时间段的 CPU 和 I/O 利用率。第四列显示当前运行的进程数和进程总数。最后一列显示上次使用的进程 ID。

https://docs.fedoraproject.org/en-US/Fedora/17/html/System_Administrators_Guide/s2-proc-loadavg.html

https://docs.fedoraproject.org/en-US/Fedora/17/html/System_Administrators_Guide/s2-proc-loadavg.html

回答by auselen

I would like to comment the accepted answer.

我想评论已接受的答案。

The fourth field consists of two numbers separated by a slash (/). The first of these is the number of currently executing kernel scheduling entities (processes, threads); this will be less than or equal to the number of CPUs.

第四个字段由用斜杠 (/) 分隔的两个数字组成。其中第一个是当前正在执行的内核调度实体(进程、线程)的数量;这将小于或等于 CPU 的数量。

I did a test program that reads integer N from input and then creates N threads and their run them forever. On RHEL 6.5 computer I have 8 processor and each processor has hyper threading. Anyway if I run my test and it creates 128 threads I see in the fourth field values that are greater than 128, for example 135. It is clearly greater than the number of CPU. This post supports my observation: http://juliano.info/en/Blog:Memory_Leak/Understanding_the_Linux_load_average

我做了一个测试程序,它从输入中读取整数 N,然后创建 N 个线程并永远运行它们。在 RHEL 6.5 计算机上,我有 8 个处理器,每个处理器都有超线程。无论如何,如果我运行我的测试并且它创建了 128 个线程,我在第四个字段中看到的值大于 128,例如 135。它显然大于 CPU 的数量。这篇文章支持我的观察:http: //juliano.info/en/Blog: Memory_Leak/Understanding_the_Linux_load_average

It is worth noting that the current explanation in proc(5) manual page (as of man-pages version 3.21, March 2009) is wrong. It reports the first number of the forth field as the number of currently executing scheduling entities, and so predicts it can't be greater than the number of CPUs. That doesn't match the real implementation, where this value reports the current number of runnable threads.

值得注意的是,proc(5) 手册页(自手册页版本 3.21,2009 年 3 月)中的当前解释是错误的。它将第四个字段的第一个数字报告为当前正在执行的调度实体的数量,因此预测它不能大于 CPU 的数量。这与实际实现不匹配,其中此值报告当前可运行线程的数量。