PDP-11 loader options

ron%brl-bmd at sri-unix.UUCP ron%brl-bmd at sri-unix.UUCP
Tue Jun 14 06:31:02 AEST 1983


From:      Ron Natalie <ron at brl-bmd>

Now wait a minute.  Steve's letter states the with the -n option the
text part of the program is not put into /dev/swap but loaded out of the
disk each time and that's why you can't unlink these files...WRONG.

When you load a 410 type (one loaded with the -n) option or a 411 (one
loaded with -i) it recognizes that there is no way the user running the
program can overwrite the text part.   It then sets up to use UNIX's
shared text mechanism.  When the program is loaded and it doesn't
already exist on the swap device, it makes a place for both the text
part and the user's writable data part in swap space.  On each
subsequent execution (if the swap image for this program is still there)
it makes a place only for the user's data image.  Dinking with the
memory management, there is only one copy of the text part of any one
shared text program in memory (and one on the swap disk) at a time.  All
user's use their own data part but share the text image.  To exploit
this even further some programs (noticeably, some shells) have modify
their assembler code to cause read-only data to be assembled into text
space (of course this only works with -n files and not -i). 

The reason you can't unlink the inode that is in use, is that the way it
knows that your 410 or 411 file is the same as one already running is
that it has the inode and disk device numbers stored in an internal
structure.  If it were to allow you to remove a file that is already
running shared text, you could replace the file with the same
inode/device combination and it would run that with new data but the old
text.

The ISVTX (or sticky) bit in the inode (designated by a 't') in ls
output, causes shared text programs not to be chucked out of swap space
when they are done running.  This allows faster startup because it only
once ever has to load in the text.

-Ron



More information about the Comp.unix.wizards mailing list