如何找出 Linux 中哪些进程正在使用交换空间? [英] How to find out which processes are using swap space in Linux?

查看:45
本文介绍了如何找出 Linux 中哪些进程正在使用交换空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Linux 下,如何找出哪个进程使用的交换空间更多?

Under Linux, how do I find out which process is using the swap space more?

推荐答案

Run top 然后按 OpEnter.现在进程应该按照它们的交换使用情况进行排序.

Run top then press OpEnter. Now processes should be sorted by their swap usage.

这是一个更新,因为我的原始答案没有提供评论中指出的问题的确切答案.来自 htop 常见问题:

Here is an update as my original answer does not provide an exact answer to the problem as pointed out in the comments. From the htop FAQ:

无法获得已用交换空间的确切大小过程.Top 通过使 SWAP = VIRT - RES 伪造此信息,但是这不是一个好的指标,因为其他东西,如视频内存也依赖于 VIRT(例如:top 说我的 X 进程正在使用81M 的交换,但它也报告我的系统作为一个整体只使用了 2M的交换.因此,我不会在 htop 中添加类似的 Swap 列因为我不知道获取这些信息的可靠方法(实际上,我认为不可能得到一个确切的数字,因为共享页).

It is not possible to get the exact size of used swap space of a process. Top fakes this information by making SWAP = VIRT - RES, but that is not a good metric, because other stuff such as video memory counts on VIRT as well (for example: top says my X process is using 81M of swap, but it also reports my system as a whole is using only 2M of swap. Therefore, I will not add a similar Swap column to htop because I don't know a reliable way to get this information (actually, I don't think it's possible to get an exact number, because of shared pages).

这篇关于如何找出 Linux 中哪些进程正在使用交换空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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