记得以前free输出的shared内存为0,我这现在为何很多进程都有shared?而且出现shared的进程以前同样存在

最大的社区版本,Ubuntu的发源地
回复
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 记得以前free输出的shared内存为0,我这现在为何很多进程都有shared?

#2

帖子 poloshiao » 2016-07-03 7:23

记得以前free输出的shared内存为0,我这现在为何很多进程都有shared?
看看 不同的 Ubuntu 版本 對於 SHR 格式 與 功能描述 有何不同

Ubuntu 12.04
http://manpages.ubuntu.com/manpages/pre ... top.1.html
t: SHR -- Shared Mem size (kb)
The amount of shared memory used by a task. It simply reflects memory that could be potentially shared with other processes.
已被使用

Ubuntu 14.04 及 以後
http://manpages.ubuntu.com/manpages/tru ... top.1.html
21. SHR -- Shared Memory Size (KiB)
The amount of shared memory available to a task, not all of which is typically resident. It simply reflects memory that could be potentially shared with other processes.
可以被用來
科学之子
帖子: 2284
注册时间: 2013-05-26 6:58
系统: Debian 9

Re: 记得以前free输出的shared内存为0,我这现在为何很多进程都有shared?

#3

帖子 科学之子 » 2016-07-03 10:26

poloshiao 写了:
记得以前free输出的shared内存为0,我这现在为何很多进程都有shared?
看看 不同的 Ubuntu 版本 對於 SHR 格式 與 功能描述 有何不同

Ubuntu 12.04
http://manpages.ubuntu.com/manpages/pre ... top.1.html
t: SHR -- Shared Mem size (kb)
The amount of shared memory used by a task. It simply reflects memory that could be potentially shared with other processes.
已被使用

Ubuntu 14.04 及 以後
http://manpages.ubuntu.com/manpages/tru ... top.1.html
21. SHR -- Shared Memory Size (KiB)
The amount of shared memory available to a task, not all of which is typically resident. It simply reflects memory that could be potentially shared with other processes.
可以被用來
受您提示,对比了free的两个man
12.04的版本说shared是过时的东西?
http://manpages.ubuntu.com/manpages/pre ... ree.1.html
14.04但后面又没说过时,
http://manpages.ubuntu.com/manpages/tru ... ree.1.html
The value is zero if none of the entries is exported by the kernel.
但我没有思考出这个值非0的原因,
以前用free看内存时shared都是0
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 记得以前free输出的shared内存为0,我这现在为何很多进程都有shared?而且出现shared的进程以前

#4

帖子 poloshiao » 2016-07-03 10:52

12.04的版本说shared是过时的东西?
1. http://manpages.ubuntu.com/manpages/pre ... ree.1.html
The shared memory column should be ignored; it is obsolete.
obsolete
廢棄不用的
(設計、樣式等) 舊式的
『生物』退化的; 發育不完全的

2. The shared memory column ...
2-1. http://manpages.ubuntu.com/manpages/pre ... ree.1.html
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The shared memory column should be ignored; it is obsolete.

2-2. http://manpages.ubuntu.com/manpages/tru ... ree.1.html
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The shared memory column represents either the MemShared value (2.4 series kernels) or the Shmem value (2.6 series kernels and later) taken from the /proc/meminfo file.

2-3. 意思是 Ubuntu 14.04 的 The shared memory column 被賦予新意義或新功能了
但我没有思考出这个值非0的原因,
The shared memory column represents either the MemShared value (2.4 series kernels) or the Shmem value (2.6 series kernels and later) taken from the /proc/meminfo file. The value is zero if none of the entries is exported by the kernel.
3. 因為我們目前的 kernel 版本是比 2.6 新 所以 上面這一句話 可以簡化成
3-1. The shared memory column represents the Shmem value taken from the /proc/meminfo file.
3-2. The value is zero if Shmem is not exported by the kernel.
回复