首页 / 缓存 / linux – 了解缓存中的程序
linux – 了解缓存中的程序
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了linux – 了解缓存中的程序,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1635字,纯文字阅读大概需要3分钟。
内容图文
![linux – 了解缓存中的程序](/upload/InfoBanner/zyjiaocheng/964/614b2b79931244f48f99e346194ff25f.jpg)
我现在有RAM和SWAP这种情况:
$free -h
total used free shared buffers cached
Mem: 7,7G 7,5G 159M 100M 75M 5,9G
-/+ buffers/cache: 1,5G 6,1G
Swap: 7,9G 408M 7,5G
我想知道……
有没有办法知道哪些程序/数据是RAM缓存的和/或它们来自哪个进程?
我的想法是,由于它们可以重复使用,因此应该有一种“识别”它们的方法.
但我的知识实在太小,无法知道如何.
非常感谢你提前.
解决方法:
is there a way to know what programs/data are RAM-cached and/or from which process do they come from?
有一个程序http://hoytech.com/vmtouch/ vmtouch.它提供信息文件缓存中文件的百分比.你可能需要编译它.这是我的电脑上的示例:
在读取不在缓存中的文件之前:
$vmtouch -v /usr/share/dict/linux.words
/usr/share/dict/linux.words
[ ] 0/1210
Files: 1
Directories: 0
Resident Pages: 0/1210 0/4M 0%
Elapsed: 0.000169 seconds
从文件中读取一些数据后:
$tail -n 10000 /usr/share/dict/linux.words >/dev/null
$vmtouch -v /usr/share/dict/linux.words
/usr/share/dict/linux.words
[ oO] 24/1210
Files: 1
Directories: 0
Resident Pages: 24/1210 96K/4M 1.98%
Elapsed: 0.000152 seconds
vmtouch frist为文件调用nmap,然后使用mincore系统调用来确定文件或其某些页面是否驻留在内存中:
男人mincore:
DESCRIPTION
mincore() returns a vector that indicates whether pages of
the calling process’s virtual memory are resident in core (RAM), and
so will not cause a disk access (page fault) if referenced. The
kernel returns residency information about the pages starting at the
address addr, and continuing for length bytes.
内容总结
以上是互联网集市为您收集整理的linux – 了解缓存中的程序全部内容,希望文章能够帮你解决linux – 了解缓存中的程序所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。