简体   繁体   English

为什么我看到一个进程的 CPU 使用率很高,但总体 CPU 空闲百分比很高?

[英]Why do I see high CPU usage for one process but the overall CPU idle percentage is high?

This is a 8 core machine.这是一台8核机器。 The %Cpu(s)->id is 99.4 but one java process already occupies 82.7% cpu usage. %Cpu(s)->id 是 99.4 但一个 java 进程已经占用了 82.7% 的 CPU 使用率。

The "top" output is as below: “顶部”输出如下:

top - 09:04:09 up 17:22,  1 user,  load average: 0.00, 0.00, 0.00
Tasks: 142 total,   1 running,  74 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.1 sy,  0.0 ni, 99.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.3 st
KiB Mem : 62876640 total,  9865752 free, 51971500 used,  1039388 buff/cache
KiB Swap:        0 total,        0 free,        0 used. 10121552 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 4859 root      20   0   50.1g  49.4g 144356 S  82.7 82.4  20:28.62 java
 3847 root      20   0    6452    792    716 S   0.3  0.0   0:09.50 rngd
    1 root      20   0   43724   5680   4196 S   0.0  0.0   0:02.30 systemd
    2 root      20   0       0      0      0 S   0.0  0.0   0:00.01 kthreadd

the answer:答案:

we have cpu = 8 cores我们有 cpu = 8 个内核

from top we have: process cpu_usage = 82.7% idle = 99.4 % id从顶部我们有:进程 cpu_usage = 82.7% idle = 99.4% id

look !看 ! lets calculate让我们计算一下

8 cores at full usage give = 800%, 8 核在完全使用情况下给出 = 800%,

so cpu usage % = > [82.7/800] * 100% = 10.3 % (calculated)所以 cpu 使用率 % = > [82.7/800] * 100% = 10.3%(计算)

cpu idle % = 100-10.3 = 89.7 % (calculated) cpu空闲% = 100-10.3 = 89.7%(计算)

well 89.7% kind of slightly different from 99.4% but will give you a flavour好吧 89.7% 与 99.4% 略有不同,但会给你一种味道

i suppose your main confusion is about 82.7%.我想你的主要困惑是大约 82.7%。

82.7% does not mean 82.7% usage of all the cpu. 82.7% 并不意味着所有 cpu 的使用率为 82.7%。 it would be so if your cpu had 1 core.如果您的 cpu 有 1 个核心,那就是这样。 for multicore cpus 100% usage means that kind of only one core is 100% busy not all the cpu.对于多核 CPU 100% 使用率意味着只有一个内核 100% 忙碌而不是所有的 CPU。

您好,这取决于您的使用情况、正在运行的服务或应用程序(eclipse、android studio、JBoss Server 等)检查它们。

Normally the CPU tries to distribute the functions/process between its cores in order to fulfill the multi-tasking.通常,CPU 会尝试在其内核之间分配功能/进程以实现多任务处理。 So, the specific process can fetch up the big part of one the cores, however the other cores and the CPU are not handling a huge load.因此,特定进程可以获取一个内核的大部分,但其他内核和 CPU 并没有处理巨大的负载。

BR BR

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM