*BSD News Article 16611


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!wupost!gumby!yale!zip.eecs.umich.edu!congo.eecs.umich.edu!khushro
From: khushro@congo.eecs.umich.edu (Khushro Shahookar)
Newsgroups: comp.os.386bsd.questions
Subject: Swapping Question
Date: 29 May 1993 19:47:47 GMT
Organization: University of Michigan Engineering, Ann Arbor
Lines: 103
Distribution: world
Message-ID: <1u8el3$7uk@zip.eecs.umich.edu>
Reply-To: khushro@congo.eecs.umich.edu (Khushro Shahookar)
NNTP-Posting-Host: congo.eecs.umich.edu

The following memory statistics show that although 16MB RAM is installed in
my system, only 5MB is actually being used, and the rest of the 8MB of
processes are swapped out. The last ps at the end shows that all of the RAM
did indeed get used, but only when the virtual memory size grew beyond 32
Meg. In other words, more than half of the virtual memory is always swapped
out, regardless of whether the RAM is filled up or not.

Questions:
1. If we have sufficient RAM, isn't everything supposed to run
completely in RAM?
2. Why should any page get swapped out when the RAM is still empty, even if
the page has not been used for a long time?
3. Is this a bug or a feature of NetBSD?
4. Did I do anything wrong here?

5. Why does swapinfo -k show half the virtual memory usage compared to ps?
The Netbsd ps(1) says that ps reports in Kbytes by default, just like
swapinfo -k.

vmstat
 procs   memory     page                    disks         faults      cpu
 r b w   avm   fre  flt  re  pi  po  fr  sr ?0 ?1 ?2 ?3   in   sy  cs us sy id
 0 0 0  4600  8488    5   0   1   1   0   0  0  0  0  0  116   43  13  3  3 94
danube# ps -augx
USER       PID %CPU %MEM   VSZ  RSS TT  STAT STARTED       TIME COMMAND
root       160  2.3  6.7  2112 1016 ??  S     1:36PM    0:53.80 X :0
root       230  0.0  0.5   176   64 p2  I+    2:42PM    0:00.40 rlogin congo.ee
root       229  0.0  0.8   176  120 p2  Is+   2:42PM    0:00.99 rlogin congo.ee
root       228  0.0  5.4  1000  828 vg  I     2:42PM    0:02.31 xterm -tn xterm
root       180  0.0  0.4   116   56 ??  Is    1:36PM    0:00.10 /usr/gnu/epoch/
root       175  0.0  1.3   268  184 p1  Is+   1:36PM    0:01.18 -sh (csh)
root       174  0.0  1.1   248  164 p0  Ss    1:36PM    0:00.47 -sh (csh)
root       232  0.0  1.1   256  168 p0  R+    3:01PM    0:00.06 ps -augx
root       172  0.0  0.2  1064   20 vg  I     1:36PM    0:00.53 /usr/bin/X11/xv
root       171  0.0  1.3   648  188 vg  I     1:36PM    0:00.48 xclock -digital
root       170  0.0  2.0  1040  304 vg  I     1:36PM    0:01.78 xman -bothshown
root       169  0.1  2.7   916  400 vg  S     1:36PM    0:01.65 /usr/bin/X11/xt
root       168  0.0  4.0  1496  608 vg  I     1:36PM    0:04.30 /usr/gnu/bin/em
root       167  0.0  2.9   916  444 vg  S     1:36PM    0:03.72 /usr/bin/X11/xt
root       173  0.0  2.6   752  384 vg  S     1:36PM    0:03.11 twm
root       161  0.0  0.2   160   20 vg  I     1:36PM    0:00.21 sh /root/.xinit
root       159  0.0  0.2   216   20 vg  I+    1:36PM    0:00.13 xinit
root       153  0.0  0.5   248   76 vg  Is    1:35PM    0:00.33 -csh (csh)
root        87  0.0  0.2   168   20 ??  Is    1:33PM    0:00.13 inetd
nobody      80  0.0  0.2   176   20 ??  Is    1:33PM    0:00.03 rwalld
root        61  0.0  0.2   152   20 ??  Is    1:33PM    0:00.03 portmap
root        59  0.0  0.2   176   20 ??  Is    1:33PM    0:00.79 lpd
root        53  0.0  0.6   188   84 ??  I     1:33PM    0:00.12 /usr/libexec/cr
root        51  0.0  0.3    72   32 ??  Is    1:33PM    0:00.32 update
root        39  0.0  0.5   148   72 ??  Is    4:36PM    0:00.19 timed
root        36  0.0  0.7   156   96 ??  Ss    4:36PM    0:00.26 syslogd
root         2  0.0  0.1     0   12 ??  DL    4:36PM    0:08.12  (swapper)
root         1  0.0  0.3   140   44 ??  Is    4:36PM    0:00.12 init -
root         0  0.0  0.1     0    0 ??  DLs   4:36PM    0:00.02  (scheduler)

TOTAL                    13184 5484

danube# swapinfo -k
Device      Kilobytes       Used  Available   Capacity
/dev/sd0b       76800       7761      69038      10%
/dev/wd0b           0  *** not available for swapping ***


-------
When all the RAM is used
------
ps -augx
USER       PID %CPU %MEM   VSZ  RSS TT  STAT STARTED       TIME COMMAND
root       209  5.7 72.0 26276 11040 p1  S     2:28PM    1:05.88 emacs -nm
root         2  5.1  0.1     0   12 ??  RL    4:36PM    0:05.28  (swapper)
root       216  2.0  1.1   256  168 p1  R+    2:32PM    0:00.09 ps -augx
root       160  1.9  5.1  2112  772 ??  S     1:36PM    0:32.15 X :0
root       175  0.0  1.2   264  172 p1  Ss    1:36PM    0:00.94 -sh (csh)
root       174  0.0  0.5   248   76 p0  Is+   1:36PM    0:00.39 -sh (csh)
root       173  0.0  1.5   752  216 vg  S     1:36PM    0:02.28 twm
root       172  0.0  0.2  1064   20 vg  I     1:36PM    0:00.53 /usr/bin/X11/xv
root       171  0.0  0.9   648  136 vg  I     1:36PM    0:00.47 xclock -digital
root       170  0.0  0.2  1040   20 vg  I     1:36PM    0:01.64 xman -bothshown
root       169  0.0  0.2   916   28 vg  I     1:36PM    0:01.31 /usr/bin/X11/xt
root       168  0.0  3.3  1496  500 vg  I     1:36PM    0:03.94 /usr/gnu/bin/em
root       167  0.4  2.3   916  340 vg  S     1:36PM    0:03.00 /usr/bin/X11/xt
root       161  0.0  0.2   160   20 vg  I     1:36PM    0:00.21 sh /root/.xinit
root       180  0.0  0.3   116   36 ??  Is    1:36PM    0:00.07 /usr/gnu/epoch/
root       159  0.0  0.2   216   20 vg  I+    1:36PM    0:00.13 xinit
root       153  0.0  0.5   248   76 vg  Is    1:35PM    0:00.33 -csh (csh)
root        87  0.0  0.2   168   20 ??  Is    1:33PM    0:00.13 inetd
nobody      80  0.0  0.2   176   20 ??  Is    1:33PM    0:00.03 rwalld
root        61  0.0  0.2   152   20 ??  Is    1:33PM    0:00.03 portmap
root        59  0.0  0.2   176   20 ??  Is    1:33PM    0:00.79 lpd
root        53  0.0  0.6   188   84 ??  I     1:33PM    0:00.11 /usr/libexec/cr
root        51  0.0  0.3    72   32 ??  Ss    1:33PM    0:00.27 update
root        39  0.0  0.3   148   44 ??  Is    4:36PM    0:00.16 timed
root        36  0.0  0.4   156   52 ??  Ss    4:36PM    0:00.21 syslogd
root       210  0.0  0.2   116   20 ??  Is    2:28PM    0:00.04 /usr/gnu/epoch/
root         1  0.0  0.3   140   44 ??  Is    4:36PM    0:00.11 init -
root         0  0.0  0.1     0    0 ??  DLs   4:36PM    0:00.02  (scheduler)

TOTAL                    38220 14008




-Khushro