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



On Mar 23, 9:05 am, "jinzish...@xxxxxxxxx" <jinzish...@xxxxxxxxx>
wrote:
My system has 4GB of RAM so I decided that I don't need to have swap
space.
However, in "top", I can still see that processes's virtual memory is
the
sum of the residential and swap memory. For example:
Swap: 0k total, 0k used, 0k free, 1189192k
cached

PID USER PR NI VIRT RES SWAP SHR S %CPU %MEM TIME+
COMMAND
9580 seki 15 0 2164 1160 1004 856 R 0.3 0.0 0:00.04 top

This is part of the output from "top".
We can confirm that no swap space is used.

Note that VIRT = RES + SWAP. SWAP is that part of the process which
isn't present in memory. This is pages which were never executed, or
perhaps which were scavenged to create free memory.

Even without swap configured, a process need not be all loaded into
memory at once.

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?

Pages of executables which are not locked into memory, and which are
not dirty, can be scavenged by the swapper. This simply means that
they are marked not-present, and the underlying memory frames are made
available for allocation. There is no need to write anything to
storage. (And in fact, that can't happen because executables and
shared libraries are mapped private).

.



Relevant Pages

  • Re: Why sticky bit on executables?
    ... non-sticky'ed executables, once they were run... ... No need with the Virtual Memory we have today. ... memory and not have to swap things out to get real contiguous ... set - eg the most used files such as sh, vi, and others, to reside ...
    (comp.unix.sco.misc)
  • Re: Is Greenspun enough?
    ... Most OSes memory map executables directly from the file ... >> system so code doesn't pollute the file cache or swap space. ... but executables have a twist. ...
    (comp.lang.lisp)
  • Re: Heaps and Foreigners
    ... >> can ask for the memory and get a pointer to it. ... cause unfathomable deaths when swap space gets low or is exhausted. ... It's probably because there is some reserve memory to print out errors ... of RAM and disk space) and virtual swap (which is just a number managed ...
    (comp.lang.lisp)
  • Re: Is Greenspun enough?
    ... Most OSes memory map executables directly from the file system so code doesn't pollute the file cache or swap space. ...
    (comp.lang.lisp)
  • Re: [PATCH] io-controller: Add io group reference handling for request
    ... Find the io group bio belongs to. ... anonymous pages (swap) you still need the page tracking functionality ... so fair to charge the current task for the whole activity. ... is some other memory hungry application which is forcing these swap outs. ...
    (Linux-Kernel)