Swap space - The Answer

Yann E. MORIN yann.morin.1998 at anciens.enib.fr
Mon Nov 11 16:52:47 PST 2002


On Tuesday 12 November 2002 01:38, you wrote:
 > code data will not be swapped but re-read from the filesystem? I can't
 > imagine!
 > At first there is no seperation between code and data on von-Neumann
 > machines. And the other problem would be the following scenario I just
 > tried: 1. remote login to a machine via ssh
 > 2. install new version of ssh over the existing
 > 3. the machine tries to swap sshd but it is code and will not be swapped
 > as it could re-read from /usr/sbin
 > 4. when re-reading /usr/sbin/sshd the should be a segfault os somethign
 > similar as sshd is onother one than the executed.
 >
 > As this problem did not occur in my previous installations of ssh I think
 > code data WILL be swapped to swap partitions or files.
 >
 > Correct? Or did I miss a thing?

I'd say it won't coredump or anything... First let me state I'm not a swap
guru at all. Whate I'll tell is what I understood from a previous linux kernel
thread some time ago... What I understood is that you can get swap without
swap partition or file. Because the system can re-read an executable from the
disk, it can discard the memory used by it and reload it next time it is
scheduled. Th eproblem arises when you change the executable while running it.

When you install a new version of an executable, the previous one will be
unlinked, but as there are still file descriptors open on it, the allocated
blocks will not be freed until it finishes. Lets rewrite your scenario this
way:

1) remote login to a machine via ssh
2) install a new version of ssh 'over' the existing one
   -> the previous sshd is _not_ overwriten! It is just unlinked, and a new
      one is created elsewhere on the filesystem.
   -> you keep goin' on with the 'old' one.
3) The machines 'swaps-out' the old sshd, but because blocks are not freed
   it is capable of re-reading them.
4) when 'resuming' your 'old' sshd session, the ssytem is able to get the
   'old' sshd. Any new connection will use the new sshd.

Am I being clear? Correct me if I say nonsense ( it's a bit late here in
France! ;-) ).

Cheers,
Yann.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| --==< °_° >==-- °---.----------------:  X  AGAINST      |  \e/  There is no  |
| web: ymorin.free.fr | SETI at home  516 | / \ HTML MAIL    |   v   conspiracy.  |
°---------------------°----------------°------------------°--------------------°
-- 
Unsubscribe: send email to listar at linuxfromscratch.org
and put 'unsubscribe lfs-support' in the subject header of the message



More information about the lfs-support mailing list