Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On my top output, at header level, swap is showing 0k used. But on each individual process the SWAP is shown as a non-zero value (output column enabled with option p). What does this mean?

Swap:  4870140k total,        0k used,  4870140k free,   571300k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND      
 2448 max       20   0  323m  87m  27m S    0  4.4   1:23.31 236m chrome  
share|improve this question

1 Answer 1

That is probably the amount of memory the program has said can be swapped out; however, you likely have RAM available, so the kernel is just going to use RAM instead of Swap. Until you have enough going on to actually use Swap, I guess those numbers wont match up with amount of swap used. RES is how much memory cannot be swapped out and VIRT is the total amount of virtual memory needed by the program (VIRT=RES+SWAP)

share|improve this answer
    
I added up VSZ for all process (from ps). This is about 5G while the total memory usage is about 1.2G (on top). If I add up all RSS (from ps) then it comes to about 1.1G. So I think it is unlikely that SWAP means swappable memory –  Max Mar 2 '11 at 4:33
    
@Max What top reports is all of the memory (by type) used by all of the pieces used by the program. If program P uses shared libs A & B, then then P's memory usage in top is reported as the sum of the memory usage of P, A, and B. If you also have program Q using lib A, Q's memory usage is reported as Q + A. Thus if you add all of the memory usage in top for a system only running P and Q, you are actually seeing the memory of P + Q + A + A + B (in other words, some of the stuff is double counted!). –  jwernerny Apr 1 '11 at 12:10

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.