From: Stephen Tweedie (sct@dcs.ed.ac.uk)
Date: 04/07/93


From: sct@dcs.ed.ac.uk (Stephen Tweedie)
Subject: Re: [Q]  When to use -N for compiling ?
Date: 7 Apr 1993 21:48:51 GMT

In article <C54o2q.4rz@news.claremont.edu>, michael@jarthur.claremont.edu (Michael Elkins) writes:

> I've noticed that if you compile with -N (making the executable non
> demand paging), it makes the binary significantly smaller. There
> don't seem to be any noticeable performance effects, so I was
> wondering what making your binary demand paging does for you?

A demand paged binary can be swapped. If you use the -N option you
get an impure executable file which does not have its various segments
padded out to page boundaries; as a consequence it cannot be swapped
or shared.

This is usually irrelevant for very small programs, which is why they
are often compiled with -N. Large programs (eg. gcc or emacs), or
programs which are likely to have multiple instances (like the shell
or xterm), should be compiled without -N so that their code pages can
be shared. If you start to run out of memory, the kernel can start to
delete unused code pages from demand pages executables - they can
always be reloaded later. This is impossible for impure executables.

So, if your program is likely to use significant amounts of memory,
then don't use -N or the kernel's memory management will be
obstructed.

Cheers,
 Stephen Tweedie.