android free命令,free命令的available

本文解析了Linux 3.14内核中新增的内存信息MemAvailable,并解释了其与传统free和buffer内存的区别,帮助理解现代系统中可用内存的真实含义。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

3.14内核新增了一个内存信息MemAvailable , 当调用free命令时可以显示为available

之前没留意过

[root@VM_167_46_centos etc]# free -h

total         used             free      shared     buff/cache      available

Mem:           993M        253M        334M         39M               405M             556M

Swap:           2.0G          82M             1.9G

我们知道used + free + buff 基本等于 total

used是被使用的

free是完全没有被使用的

shared是被程序之间可以(已经被)共享使用的

buffers是指用来给块设备做的缓冲大小,它只记录文件系统的metadata以及 tracking in-flight pages

cached是用来给文件做缓冲

也就是 buffers是用来存储目录里面有什么内容,权限等等。而cached直接用来缓存我们打开的文件

available到底是什么

Many load balancing and workload placing programs check /proc/meminfo to estimate how much free memory is available. They generally do this by adding up "free" and "cached", which was fine ten years ago, but is pretty much guaranteed to be wrong today.

It is wrong because Cached includes memory that is not freeable as page cache, for example shared memory segments, tmpfs, and ramfs, and it does not include reclaimable slab memory, which can take up a large fraction of system memory on mostly idle systems with lots of files.Currently, the amount of memory that is available for a new workload,without pushing the system into swap, can be estimated from MemFree, Active(file), Inactive(file), and SReclaimable, as well as the "low"watermarks from /proc/zoneinfo.However, this may change in the future, and user space really should not be expected to know kernel internals to come up with an estimate for the amount of free memory.It is more convenient to provide such an estimate in /proc/meminfo. If things change in the future, we only have to change it in one place.

也就是说available才是你的"可用内存" , 而不是像过去那样简单的把free和buffer加起来

available 小于 free+buffer 是一定的了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值