linux - 为什么 TOP 命令的详细列表中列出的 SWAP 大于摘要中的?

标签 linux memory memory-management ubuntu top-command

TOP 命令结果:

Mem:   3991840k total,  1496328k used,  2495512k free,   156752k buffers  
**Swap**:  3905528k total,     **3980k** used,  3901548k free,   447860k cached  

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  **SWAP** COMMAND  
28250 www-data  20   0  430m 210m  21m R   63  5.4   0:07.29 **219m** apache2  
28266 www-data  20   0  256m  40m  21m S   30  1.0   0:01.94 **216m** apache2  
28206 www-data  20   0  260m  44m  21m S   27  1.1   0:10.27 **215m** apache2  
28259 www-data  20   0  256m  40m  21m S   26  1.0   0:02.21 **216m** apache2  

详细信息列表显示一组 apache2 进程正在使用大约 210m+ 的 SWAP 内存,但摘要报告仅使用了 3980k。详细列表中的总 SWAP 内存比摘要中的大得多。这两个 swap 指的是同一个东西吗?

最佳答案

引自http://www.linuxforums.org/articles/using-top-more-efficiently_89.html :

VIRT=RES+SWAP

As explained previously, VIRT includes anything inside task's address space, no matter it is in RAM, swapped out or still not loaded from disk. While RES represents total RAM consumed by this task. So, SWAP here means it represents the total amount of data being swapped out OR still not loaded from disk. Don't be fooled by the name, it doesn't just represent the swapped out data.

关于linux - 为什么 TOP 命令的详细列表中列出的 SWAP 大于摘要中的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5196491/

相关文章:

python - 在 Python 中准确测量对象大小 - Sys.GetSizeOf 不起作用

c - mmap 返回无法分配内存,即使有足够的内存

c - fclose 不可能的正确错误处理(根据联机帮助页)?

linux - 如何在linux中配置pam,使登录ID和密码不应该相同?

linux - 共享库无法编译,*.a 文件丢失

c - 堆栈内存地址区

MySQL 内存使用过多

C# 使用内存映射文件

Java BigInteger 内存分配

windows - 堆栈增长如何在 Windows 和 Linux 上工作?