Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tlug: Overwriting running executable



>>>>> "Neil" == Neil Booth <NeilB@example.com> writes:

    Neil> The other day, I upgraded bash from the somewhat old version
    Neil> they ship with RH 5.1 (why?).
[...]
    Neil> So how does this work? My first thought was that Linux must
    Neil> have to load the full old executable into memory and mark

Yes.

    Neil> those pages as unfreeable until their reference count
    Neil> becomes zero.

No, if they leave memory they end up in swap.  Only if you demand-load
DLLs (eg, the GNU Emacs in Debian-JP does this) will any executable
code be left on disk.  Unix systems don't do overlays and silliness
like that, they use virtual memory.  However ...

    Neil> Then I had a more devious idea. Maybe the old executable is
    Neil> still on the disk, but is just no longer referenced by any
    Neil> directory entries. Its inode's reference count would be
    Neil> still be non-zero, the reference being the currently running
    Neil> instance of the old executable.

This is why you can do something like `prog data; rm data' with no
ill-effects.

    Neil> And why doesn't Windows (even NT) do it this way? It seems
    Neil> so much cleaner, in that all processes get to do what they
    Neil> want without errors, than marking files such as DLLs as
    Neil> read-only when in use the way Windows appears to.

Dunno for sure about NT or Windows, but I suspect that the monolithic
nature of MS products makes them so big that even with a machine with
buckets'o'RAM [tm] you don't want all of Word in memory (even virtual)
at once.  So demand-loading is the normal way to do it.  I don't
understand marking the disk copy R/O though.

Ah, yes, code overlays.  Possibly for efficiency reasons, Windows
avoids virtual memory, but prefers overlays?  Especially given that
Windows implements swap inefficiently (I don't know how bad it is).
Then if the overlay gets used once, you'd better not change it until
the process is restarted.

You also have to remember that except for NT, all MS OSes are in
principle single-user.  If the user is busy upgrading, she can't be
doing real work.  In NT, the user isn't upgrading, the sysadmin is,
but it works out the same.  I don't know anybody who logs into an NT
box remotely; even servers are effectively single-user workstations,
although they do multitask pretty efficiently.

Ie, doesn't much hurt anybody to do that.

-- 
University of Tsukuba                Tennodai 1-1-1 Tsukuba 305-8573 JAPAN
Institute of Policy and Planning Sciences        Telfax: +81 (298) 53-5091
__________________________________________________________________________
__________________________________________________________________________
What are those two straight lines for?  "Free software rules."
---------------------------------------------------------------
Next Nomikai: 20 November, 19:30 Tengu TokyoEkiMae 03-3275-3691
Next Technical Meeting: January, 1999 (details TBA)
---------------------------------------------------------------
Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links