[comp.unix.internals] why different swapping modes on executables?

sking@nowhere.uucp (Steven King) (03/12/91)

   TFM page for a.out defines two magic numbers 0410 & 0413 for executables,
 and describes the difference as:

        "A magic number of 0410 indicates thats the executable must
       be swapped through the private swapping store of the UNIX system,
       while the magic number of 0413 causes the system to attempt to
       page the text directly from the a.out file".

    While I think I understand what the difference is, I don't understand
 why the difference. Is there any advantage to one over the other? How
 does one, short of directly editing the binary, assign one or the other?
 ( the link editor doesn't offer any clues ) 
-- 
Look Ma! No .sig!
                                        ..!cs.utexas.edu!ut-emx!nowhere!sking

jik@athena.mit.edu (Jonathan I. Kamens) (03/12/91)

In article <1991Mar12.012401.557@nowhere.uucp>, sking@nowhere.uucp (Steven King) writes:
|>         "A magic number of 0410 indicates thats the executable must
|>        be swapped through the private swapping store of the UNIX system,
|>        while the magic number of 0413 causes the system to attempt to
|>        page the text directly from the a.out file".
|> 
|>     While I think I understand what the difference is, I don't understand
|>  why the difference. Is there any advantage to one over the other? How
|>  does one, short of directly editing the binary, assign one or the other?
|>  ( the link editor doesn't offer any clues ) 

  Well, if you're installing a binary on an NFS server that lots of machines
are going to be using, you probably want the machines using it to copy the
binary into local swap space, because of the performance gain that will
result.  If, on the other hand, you're installing a binary on a local disk,
then you won't get any gain by copying the file into swap space, since that'll
just be another local disk (and me even be an NFS swap partition, which would
be worse).

  My ld(1) claims that "-z" causes 0413 to be used, and that's the default,
while "-n" causes 0410 to be used.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

sef@kithrup.COM (Sean Eric Fagan) (03/12/91)

In article <1991Mar12.012401.557@nowhere.uucp> sking@nowhere.uucp (Steven King) writes:
>    While I think I understand what the difference is, I don't understand
> why the difference. Is there any advantage to one over the other? How
> does one, short of directly editing the binary, assign one or the other?
> ( the link editor doesn't offer any clues ) 

At one point, the linker would just willy-nilly put things back to back.
For example, text might end at 0x1231, and data would then begin at 0x1232.
When paging, you do *not* want to use old data.  Therefore, if you want to
page directly from disk, you arrange things such that everything is in a
decent arrangement (which is what your kernel would do for you when it
swapped pages to the swap device).

At least, that's how I understand it.

-- 
Sean Eric Fagan  | "I made the universe, but please don't blame me for it;
sef@kithrup.COM  |  I had a bellyache at the time."
-----------------+           -- The Turtle (Stephen King, _It_)
Any opinions expressed are my own, and generally unpopular with others.

martin@adpplz.UUCP (Martin Golding) (03/14/91)

In <1991Mar12.104352.23097@kithrup.COM> sef@kithrup.COM (Sean Eric Fagan) writes:

>In article <1991Mar12.012401.557@nowhere.uucp> sking@nowhere.uucp (Steven King) writes:
>>    While I think I understand what the difference is, I don't understand
>> why the difference. Is there any advantage to one over the other? How
>> does one, short of directly editing the binary, assign one or the other?
>> ( the link editor doesn't offer any clues ) 

>At one point, the linker would just willy-nilly put things back to back.
>For example, text might end at 0x1231, and data would then begin at 0x1232.
>When paging, you do *not* want to use old data.  Therefore, if you want to
>page directly from disk, you arrange things such that everything is in a
>decent arrangement (which is what your kernel would do for you when it
>swapped pages to the swap device).

In the very bad old days, PDP 11's had two ways to map memory: one 
combined the data and program in a single 64k segment, and one had 
separate (64k) data and program spaces. Given the addressing modes, 
the difference between data and program accesses were a study in themselves.
My impression is that the (original) version of the Magic Number was
the actual value to load into the PDP 11 MMU control register, to select
one or the other model.

Martin Golding    | sync, sync, sync, sank ... sunk:
Dod #0236         |  He who steals my code steals trash.
{mcspdx,pdxgate}!adpplz!martin or martin@adpplz.uucp