O que devo saber sobre gerenciamento de memória?

2

primeiro de tudo:

  • Eu não uso o stackadmin ou similar, então não vote em se mudar para lá,
  • Estou lendo man top e papel "o que todo programador deve saber sobre memória ..."
  • Eu preciso de uma explicação muito simples, como para retardar;)

Após seguir o dump principal:

top - 11:21:19 up 37 days, 21:16,  4 users,  load average: 0.41, 0.75, 1.09
Tasks: 313 total,   5 running, 308 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.4%us,  0.6%sy,  0.9%ni, 96.2%id,  0.1%wa,  0.0%hi,  1.9%si,  0.0%st
Mem:  132103848k total, 131916948k used,   186900k free,    54000k buffers
Swap: 73400944k total, 73070884k used,   330060k free, 13931192k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 3305 tudb      25  10  144m  52m  940 R  6.0  0.0   1306:09 app 
 3011 tudb      15   0 71528  19m  604 S  3.3  0.0 171:57.83 app 
 3373 tudb      25  10  209m  93m  940 S  3.0  0.1   1074:53 app 
 3338 tudb      25  10  144m  47m  940 R  2.7  0.0 780:48.48 app
 4227 tudb      25  10  208m  99m  904 S  1.3  0.1 198:56.01 app
 8506 tudb      25  10 80.7g  49g  932 S  2.0 39.6 458:31.22 app 

Eu estou querendo saber o que é:

  • RES (meu expl. consumo de memória física? ver 49GB)
  • VIRT (disco mapeado em memória para armazenar em cache? consulte 80 GB)
  • SHR (páginas compartilhadas?)
  • Trocar: (este rótulo em cache - para o disco mapeado na memória no cache de troca?)
  • A soma de RES deve dar MEM: X usado? ou talvez a soma de VIRT?
por Der Hochstapler 18.03.2011 / 12:42

1 resposta

0

Direto de top(1) :

VIRT -- Virtual Image (kb) 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. (Note: you can define the STATSIZE=1 environment variable and the VIRT will be calculated from the /proc/#/state VmSize field.)

VIRT = SWAP + RES.

SWAP -- Swapped size (kb) The swapped out portion of a task's total virtual memory image.

RES -- Resident size (kb) The non-swapped physical memory a task has used.

RES = CODE + DATA.

CODE -- Code size (kb) The amount of physical memory devoted to executable code, also known as the 'text resident set' size or TRS.

DATA -- Data+Stack size (kb) The amount of physical memory devoted to other than executable code, also known as the 'data resident set' size or DRS.

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.

Leia também Linux comeu minha RAM .

    
por 18.03.2011 / 12:44