[H-GEN] Re: The `save text' attribute.

Martin Pool m.pool at pharos.com.au
Sun Jul 27 19:38:17 EDT 1997


> Date: Sun, 27 Jul 1997 00:59:39 +1000 (GMT+1000)
> From: Byron Ellacott <s337166 at student.uq.edu.au>

> On Sun, 27 Jul 1997, Jason Parker wrote:

> > Is there any point to doing this?  (Keeping in mind that my box is
> > pretty puny.)  I would have imagined that keeping a copy of the text
> > on swap would have little point, as they're both the same physical
> > disk on my system.

I may be wrong, but I don't think the sticky bit does anything to
executables on modern systems.

> the swap space is much smaller and faster to locate data on than a
> normal filesystem (one would hope..)  so commonly executed binaries
> stored permanently on swap would theoretically execute those few
> seconds faster.

Why do you say that it should be faster?  I would expect that the swap
space is probably not much faster than reloading an image from disk.
Once it's in VM, the system just keeps track of which pages map to
which disk blocks[*], so reading a page from the swap space is no
slower than reading it from anywhere else on the disk.

Of course, if you do store the program in the swap space, then you
have the overhead of writing it onto the disk, updating the bitmap,
and also since it's closer to being full accesses which need to use
swap will be slower.

If you had your swap space on an immensely fast disk it might pay off,
but then you might as well just put the programs on a normal partition
on that disk.

A more useful possibility is to allow executables to be wired into RAM
and never swapped, but this is rarely implemented in Unix and would
not work well for many programs as it would also retain all of the
startup and exceptional-case code in memory.  Linux generally does a
pretty good job at guessing what to keep in memory.

OS/2, and perhaps NT allow the programmer to specify at link-time that
certain segments of a program should be preferentially kept in memory
or discarded, so that the startup code can be dropped as soon as it is
executed and the event loop will never be swapped.  It's a nice idea
but you have to put some effort into profiling your program's VM
behaviour to make it work.

-- 
Martin Pool <m.pool at pharos.com.au>
Pharos Business Solutions

[*] glossing over a lot of details here, I know.
----------------------- HUMBUG General List --------------------------------
echo "unsubscribe general" | mail majordomo at humbug.org.au # To Unsubscribe



More information about the General mailing list