Qual é a diferença entre USED e VIRT?

0

Em a página de manual de top ,

Qual é a diferença entre USED e VIRT? USADO é "RES" + "SWAP". É "VIRT - USADO" igual a páginas que foram mapeadas, mas não usadas?

O "VIRT" ou "USED" inclui o tamanho usado pelo espaço do kernel?

O "RES" contém "CODE" e "DATA"?

O que é "pgms"?

Obrigado.

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)

....

  1. 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.

  2. 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.

    
por Tim 29.10.2018 / 16:11

1 resposta

1

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?

Sim. Em geral, esse é o espaço alocado pelo programa que ele nunca tocou (muitas coisas são alocadas em grandes blocos, muitas vezes com a sobrecarga, porque a alocação de espaço é computacionalmente cara).

Does "VIRT" or "USED" include the size used by kernel space?

Nenhum deles é responsável pelo espaço alocado em nome do processo no espaço do kernel. Na maioria dos casos, isso não importa, porque a maioria dos programas simplesmente não usa muito espaço na memória do kernel.

Does "RES" contain "CODE" and "DATA"?

Sim, mas não necessariamente todos os dois. CÓDIGO e DADOS podem residir parcialmente no SWAP (eles podem realmente residir inteiramente no SWAP, mas somente se o processo não estiver realmente executando nenhum código no momento).

    
por 29.10.2018 / 20:47