LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-02-2011, 01:19 AM   #1
kdelover
Member
 
Registered: Aug 2009
Posts: 311

Rep: Reputation: 36
Question about top


Free command shows the following output for swap.

Code:
Swap:         7820        518       7302
Used is 518 Megs.

If i do a top and sort the list by swap usage i see something like this:

Code:
3.8   1:28.33 407m java
7.0  24:10.62 360m firefox-bin
0.0   0:00.08 267m evolution-data-
0  0.0   0:00.07 265m evolution-data-
0  0.0   0:00.06 265m evolution-data-
0  0.0   0:00.05 263m evolution-data-
0  0.0   0:00.06 262m evolution-data-
0  0.0   0:00.06 261m evolution-data-

..so on..
so what exactly is this 407m 360m,265 m e.t.c ? And what is the m over here?is it megabytes or megabits? The man page of top says:
Code:
 
SWAP  --  Swapped size (kb)
          The swapped out portion of a task's total virtual memory image.
Basically i want to know what are the pages and what process do they belong to ,which are being swapped out.

Thanks !
 
Old 09-02-2011, 01:41 AM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 988
Blog Entries: 4

Rep: Reputation: 254Reputation: 254Reputation: 254
Greetingz!

First rule: 'top' lies. Anything having to do with RAM, Swap, threads, CPU usage, etc is an aggregate of all parent-child processes.

This is further exacerbated by the fact that a system doesn't exacty differentiate between real RAM and disk-based "swap". Systems only care about "memory" (which is what both RAM and swap are...just memory).

Example:
I'm not using any swap...according to 'free -m'
Code:
luser@server(Linux)$ free -m|egrep "tot|Swa"
        total  used   free
Swap:    4095     0   4095
luser@server(Linux)$
But top lies. It lies so bad that it lies to us *twice*.
Once in the swap usage it states right under "mem", and again when we tell it to list swap usage (see red text);

Code:
top - 23:37:04 up 65 days, 17:29,  3 users,  load average: 0.02, 0.02, 0.01
Tasks: 186 total,   1 running, 181 sleeping,   0 stopped,   4 zombie
Cpu(s):  0.3%us,  0.6%sy,  0.0%ni, 99.0%id,  0.1%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   8174592k total,  4357676k used,  3816916k free,   370596k buffers
Swap:  4194296k total,      412k used,  4193884k free,  3578100k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  SWAP COMMAND                        
 3868 nscd      15   0  307m 2848 1620 S  0.0  0.0   1154:47 304m nscd                            
 7278 sdmigr    15   0  234m 7260 2844 S  0.0  0.1   0:00.27 227m httpd                           
 7270 sdmigr    15   0  234m 7316 2868 S  0.0  0.1   0:00.24 227m httpd                           
 7272 sdmigr    15   0  234m 7316 2876 S  0.0  0.1   0:00.17 227m httpd                           
 7276 sdmigr    15   0  234m 7328 2848 S  0.0  0.1   0:00.34 227m httpd                           
 7268 sdmigr    15   0  234m 7332 2884 S  0.0  0.1   0:00.25 227m httpd                           
 7263 sdmigr    15   0  234m 7356 2836 S  0.0  0.1   0:00.25 227m httpd                           
 7266 sdmigr    15   0  234m 7372 2864 S  0.0  0.1   0:00.21 227m httpd                           
 7264 sdmigr    15   0  234m 7380 2884 S  0.0  0.1   0:00.37 227m httpd                           
15416 root      15   0  233m 9.9m 5924 S  0.0  0.1   0:01.81 223m httpd                           
21754 mysql     18   0  185m  24m 4888 S  0.0  0.3   0:23.86 161m mysqld
 
Old 09-02-2011, 01:49 AM   #3
kdelover
Member
 
Registered: Aug 2009
Posts: 311

Original Poster
Rep: Reputation: 36
For me the swap usage in top and free is pretty much the same,i do not see a huge difference though.But back to my question what is m under the swap column of top ?megabits or megabytes? currently,my swap used is 279 MB & in top i see around atleast a dozen of processes with swap values as 100m,150m,519m e.t.c ..if i total this up,that would be more than 279 MB.

Last edited by kdelover; 09-02-2011 at 01:51 AM.
 
Old 09-02-2011, 01:59 AM   #4
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,278

Rep: Reputation: 148Reputation: 148
From top output, i think you refer VIRT, VIRT = SWAP + RES. it means swap + physical memory used by task
To refer memory paging,
http://en.wikipedia.org/wiki/Paging
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Question about using TOP command eyeh8flaherty Linux - Newbie 2 03-06-2009 11:09 AM
Question about TOP ryanlum Linux - Software 2 05-27-2008 11:14 PM
top command question mokku Linux - Newbie 3 11-21-2007 11:04 AM
Best: Question about X and top Scythe Slackware 3 10-15-2003 11:05 AM
top question anoop_chandran Linux - General 5 12-31-2001 10:02 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration