[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: Re: Somethings about libraries..
On Mon, Nov 20, 2000 at 11:05:00PM +0500, D ee p a K wrote:
> >> How can the kernel know that the new program is different from
> >> the one it loaded just a short while ago.
> if the original code file is replaced by a new copy then a new inode
> entry is created and the previous one remains until at least one
> instance of it is executing.
That's right. The old one stays. But the old guy doesn't stay in
the vnode cache. If you look for "/home/user/a.out" in the vnode
cache, you get the new version, rather than the old.
> the question still remains that how the process already running react
> to new code. if i manually open the file & copy the data to it.
When you manually open and write to the executable, the kernel has a
chance to update it's vnode cache. Remember, UNIX processes instantiate
their pages lazily. The pages which have been already instantiated, will
point to old inodes and the ones which haven't been, will point to the
But I suspect that there are mechanisms which prevent you from writing
to a file, while it is being executed. If you have a.out open in gdb,
gcc can't write to it.