What is the difference between USED and VIRT? USED is "RES" + "SWAP". Is "VIRT - USED" equal to pages that have been mapped but not used?
Does "VIRT" or "USED" include the size used by kernel space?
Does "RES" contain "CODE" and "DATA"?
What is "pgms"?
Thanks.
For each such process, every memory page is restricted to a single quadrant from the table below. Both physical memory and virtual
memory can include any of the four, while the swap file only includes #1 through #3. The memory in quadrant #4, when modified, acts as its own dedicated swap file.Private | Shared 1 | 2 Anonymous . stack | . malloc() | . brk()/sbrk() | . POSIX shm* . mmap(PRIVATE, ANON) | . mmap(SHARED, ANON) -----------------------+---------------------- . mmap(PRIVATE, fd) | . mmap(SHARED, fd) File-backed . pgms/shared libs | 3 | 4
The following may help in interpreting process level memory values displayed as scalable columns and discussed under topic `3a.
DESCRIPTIONS of Fields'.%MEM - simply RES divided by total physical memory CODE - the `pgms' portion of quadrant 3 DATA - the entire quadrant 1 portion of VIRT plus all explicit mmap file-backed pages of quadrant 3 RES - anything occupying physical memory which, beginning with Linux-4.5, is the sum of the following three fields: RSan - quadrant 1 pages, which include any former quadrant 3 pages if modified RSfd - quadrant 3 and quadrant 4 pages RSsh - quadrant 2 pages RSlk - subset of RES which cannot be swapped out (any quadrant) SHR - subset of RES (excludes 1, includes all 2 & 4, some 3) SWAP - potentially any quadrant except 4 USED - simply the sum of RES and SWAP VIRT - everything in-use and/or reserved (all quadrants)
....
USED -- Memory in Use (KiB) This field represents the non-swapped physical memory a task is using (RES) plus the swapped out portion of its address space (SWAP).
See `OVERVIEW, Linux Memory Types' for additional details.
VIRT -- Virtual Memory Size (KiB) The total amount of virtual memory used by the task. It includes all code, data and shared libraries plus pages that have been swapped out and pages that have been mapped but not used.
See `OVERVIEW, Linux Memory Types' for additional details.