Re: Why would top show the processes are using swap when there is no swap space?



"jinzishuai@xxxxxxxxx" <jinzishuai@xxxxxxxxx> wrote:
This is part of the output from "top".
We can confirm that no swap space is used.
However, VIRT=RES+SWAP and SWAP is not zero:
VIRT=2164, RES=1144, SWAP=1020 and 2164=1144+1020

My question is: since there is no space disk, where to swap to pages
to?
Thanks a lot.

I'm not sure if this is what you are seeing... but not all
virtual memory is RAM or SWAP! The only thing written to actual
swap space is data, not program code.

An ELF executable binary has code pages that are non-writeable
and can be shared between different processes. That means the
disk file can be, and is, used instead of swap space. When
program code is "swapped out", the RAM is merely marked as
available, but nothing is saved to disk because it is already on
disk. If part of it needs to be paged in it is read from the
original executable binary file, not from you swap space.

I don't know if it works this way, but if the program code for
your above program takes up 2164K, and only 1144K has been paged
in, it probably will show 1020K as in "SWAP".

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: dynamic allocation of swap disk space
    ... >> to see if it ever comes out of the thrashing. ... > Swap space fills up because you have overcommitted memory. ... > Increasing the amount of swap space will just use more disk. ... Imagine a system with limited physical RAM, and limited swap space, running a ...
    (Linux-Kernel)
  • Re: Swap on software RAID1 - swap
    ... any disk that crashed that had used swap space will hang the system ... if you use raid'd swap space, you can protect against the one disk dying ... > swapped memory to be there, and possibly hang if it's not? ...
    (Debian-User)
  • Re: OS X and Free Disk Space?
    ... disk space, and I don't know enough about the underpinnings of the OS to ... If you can't allocate contiguous swap space, ... particular fragment of newly cleaned up space leaning against a similar ... As a working principle, don't allow your disk to be more than 80% full. ...
    (uk.comp.sys.mac)
  • Re: D3/Linux login problem
    ... "Jon Dempsey" wrote ... Corrupted disk under swap space. ... It's a fair chance that the disk may have taken a hit. ... And yes, fix. ...
    (comp.databases.pick)
  • Re: Why would top show the processes are using swap when there is no swap space?
    ... I am 100% sure that there is no swap space used. ... But if it is as described "swapped out", then deleting the binary file ... on disk would make the swap in impossible and thus I got a crash. ... swap space is data, not program code. ...
    (comp.os.linux.development.system)