Mailing List ArchiveSupport open source code!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]tlug: Overwriting running executable
- To: tlug <tlug@example.com>
- Subject: tlug: Overwriting running executable
- From: Neil Booth <NeilB@example.com>
- Date: Mon, 26 Oct 1998 20:25:56 +0900
- Content-Transfer-Encoding: 7bit
- Content-Type: text/plain; charset=us-ascii
- Organization: ...
- Reply-To: tlug@example.com
- Sender: owner-tlug@example.com
The other day, I upgraded bash from the somewhat old version they ship with RH 5.1 (why?). Anyway, I extracted the RPM, and of course I extracted it from a running bash shell. Coming from Windows, I was slightly surprised to see that there were no errors about the bash executable being in use, but didn't think about it much more apart from a minor irritation logged at the back of my mind. Well, on Saturday I downloaded the latest Windowmaker, and compiled that. The install script overwrote the old executable with the new one. I was doing all this from a windowed shell running under the old version of Windowmaker. Again, there were no errors. More curious this time, I checked the timestamp on the "wmaker" executable in the relevant "bin" directory, and sure enough it was the new one. I was suspicious, wondering what would happen if some of the Windowmaker executable were not in memory, and a page fault were caused. I assumed it would load in some spurious code from the new executable. But nothing was crashing. So how does this work? My first thought was that Linux must have to load the full old executable into memory and mark those pages as unfreeable until their reference count becomes zero. Then I had a more devious idea. Maybe the old executable is still on the disk, but is just no longer referenced by any directory entries. Its inode's reference count would be still be non-zero, the reference being the currently running instance of the old executable. But then as soon as WM is exited, the inode's reference count is decremented to zero and the space on the filesystem becomes free. This method would avoid the need to bring the whole image into memory and mark it as semi-permanent, as it is still on the disk. I suspect this latter way is what happens in practice. Can anyone confirm? And why doesn't Windows (even NT) do it this way? It seems so much cleaner, in that all processes get to do what they want without errors, than marking files such as DLLs as read-only when in use the way Windows appears to. Neil. -------------------------------------------------- Pile up the benefits that accrue from studying by the light of fireflies reflected on the snow... --------------------------------------------------------------- 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
- Follow-Ups:
- tlug: Overwriting running executable
- From: "Stephen J. Turnbull" <turnbull@example.com>
Home | Main Index | Thread Index
- Prev by Date: Re: tlug: RE: Mounting my cdrom's
- Next by Date: tlug: Mounting my cdrom's
- Prev by thread: Re: tlug: Mounting my cdrom's
- Next by thread: tlug: Overwriting running executable
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links