[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]
Re: Somethings about libraries..
On Fri, Nov 17, 2000 at 11:02:46PM +0530, Arsalan Zaidi wrote:
> You know, I wonder about this...
> It may be possible yes, but is it done in practice?
Yes. All Unixes, including Linux do it.
> Take this e.g.
> I compile a prog, a.out and run it, loading it into memory. I then switch
> VT's, make a few changes to the source file and recompile. I then run the
> output file (a.out) from the new VT...
> My Q is this. How can the kernel know that the new program is different from
> the one it loaded just a short while ago. If it tries to share code between
> these processes, the result would be, well; interesting.
> True, the kernel could keep a track of the timestamp and use checksums...
> but I doubt Linux does this...
Kernel doesn't have to check the timestamp. The write to a.out, also
goes through the same kernel. Before writing the updated copy of a.out
to the disk, it updates it's cache. Everybody reading it, as well as
mmap'ing it immediately see the changes.