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



Thank you both.
I am 100% sure that there is no swap space used. The /proc/swaps file
is empty and free shows 0 for swap also.

I think Floyd's idea about the code may be the case.
There are times that when I recompiled the running code, the running
code crashed.
This shouldn't happen if the whole code is loaded into the RAM at the
beginning.
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.
Thank you very much.

Shi

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) f...@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: Why would top show the processes are using swap when there is no swap space?
    ... We can confirm that no swap space is used. ... since there is no space disk, ... swap space is data, not program code. ... original executable binary file, ...
    (comp.os.linux.development.system)
  • 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)