The article has been translated. The original is available at the link
The file system /proc
is a virtual file system. It is not stored on disk, but created in memory and used to provide information about the system (initially about processes, hence the name).
From /proc/meminfo
you can get information about free memory, used (both physical and swap), as well as shared (shared memory) and buffers.
/proc
man.
:
# cat /proc/meminfo
MemTotal: 16344972 kB
MemFree: 13634064 kB
Buffers: 3656 kB
Cached: 1195708 kB
SwapCached: 0 kB
Active: 891636 kB
Inactive: 1077224 kB
HighTotal: 15597528 kB
HighFree: 13629632 kB
LowTotal: 747444 kB
LowFree: 4432 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 968 kB
Writeback: 0 kB
Mapped: 280372 kB
Slab: 684068 kB
Committed_AS: 1576424 kB
PageTables: 24448 kB
ReverseMaps: 1080904
VmallocTotal: 112216 kB
VmallocUsed: 428 kB
VmallocChunk: 111088 kB
:
$ cat /proc/meminfo MemTotal: 16464260 kB MemFree: 5206868 kB Buffers: 17980 kB Cached: 7395552 kB SwapCached: 114124 kB Active: 5590956 kB Inactive: 4426264 kB Active(anon): 2191992 kB Inactive(anon): 416676 kB Active(file): 3398964 kB Inactive(file): 4009588 kB Unevictable: 32204 kB Mlocked: 13808 kB SwapTotal: 2096476 kB SwapFree: 1264996 kB Dirty: 144 kB Writeback: 0 kB AnonPages: 2547488 kB Mapped: 55404 kB Shmem: 56 kB Slab: 956820 kB SReclaimable: 884568 kB SUnreclaim: 72252 kB KernelStack: 4792 kB PageTables: 44052 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 10328604 kB Committed_AS: 3304140 kB VmallocTotal: 34359738367 kB VmallocUsed: 307816 kB VmallocChunk: 34359426296 kB HardwareCorrupted: 0 kB AnonHugePages: 1689600 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 7488 kB DirectMap2M: 16764928 kB
, .
MemTotal : ( ).
MemFree : LowFree HighFree.
MemShared : 0; .
Buffers : . . , . ( 20 ).
Cached : SwapCache.
SwapCache: , - , . , , . -.
C "" "". , , , , . , , (pagetable) .
. " " ( ). . . .
Active : , . .
Inact_dirty : "" , " ". . , . , -. , , , , , , .
Inact_clean: , . , "".
Inact_target : , , , . . . , -, , , . , , , " , " " ".
HighTotal : . (highmem) - , () 860 . . .
LowTotal: highmem-.
LowFree : . , . .
SwapTotal : .
SwapFree : . Swap - , .
Dirty : , .
Writeback: , .
Mapped : mmaped, , .
Slab : .
Committed_AS: , 99,99% , OOM (out of memory, ). , (overcommit). , 1 malloc, . , , . , . , mmap , , . . Committed_AS - , / .
PageTables : , .
ReverseMaps : .
VmallocTotal : vmalloc.
VmallocUsed : vmalloc.
VmallocChunk : vmalloc.
, , , . - , . , . , , , , . , , "" . , . (, , ), .
, , , , .
, . , top.
00 processes: 397 sleeping, 2 running, 1 zombie, 0 stopped CPU0 states: 0.1% user, 0.3% system, 0.0% nice, 99.1% idle CPU1 states: 0.3% user, 2.0% system, 0.0% nice, 97.1% idle CPU2 states: 2.3% user, 8.1% system, 0.0% nice, 88.4% idle CPU3 states: 100.0% user, 0.0% system, 0.0% nice, 0.0% idle Mem: 16167672K av, 16124948K used, 42724K free, 1710184K shrd, 351304K buff Swap: 12582608K av, 15892K used, 12566716K free 13326028K cache
:
top - 05:49:20 up 59 days, 19:01, 36 users, load average: 3.00, 3.05, 3.01 Tasks: 344 total, 3 running, 340 sleeping, 0 stopped, 1 zombie Cpu(s): 7.0%us, 27.8%sy, 0.0%ni, 64.7%id, 0.4%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 16464260k total, 11263872k used, 5200388k free, 18148k buffers Swap: 2096476k total, 831480k used, 1264996k free, 7400016k cached
, :
Mem: 16167672K av, 16124948K used, 42724K free, 1710184K shrd, 351304K buff Swap: 12582608K av, 15892K used, 12566716K free 13326028K cache
, 16124948K, 15 , , , .
$ free total used free shared buffers cached Mem: 16167672 16129820 37852 1710184 351312 13330324 -/+ buffers/cache: 2448184 13719488 Swap: 12582608 15892 12566716 Looking at the third line: -/+ buffers/cache: 2448184 13719488
2448184 (= 2 ) / , 13 , . , free , , , .
:
$ cat /proc/<pid>/maps ... $ cat /proc/<pid>/status