James wrote:
> -Is this true ?
> -
> -On my system, it is possible to compile/link a new (changed) version of
> -a program, while a copy is still running. After the link, the running
> -old copy no more have a valid executable, thus. How come ?
>
> because the program is probably small enough to get loaded into ram all in
> one go.
Programs don't get loaded into RAM; they get mapped into the process'
address space. If the contents of the executable happened to be in RAM
when the file was modified (if this were possible), the bits that were
in RAM would be modified.
> how does linux handle files that are opened more than once?
It depends upon what you mean by opened.
> i sometimes have the same c source file open in 2 separate terminals
> (i use one as reference, helps when writing functions where the
> prototypes are right at the top, saves jumping up and down the
> screen all the time) one with vi, the other with less (or vi). The
> first copy i edit, save to, compile etc, the other is just opened.
Editors don't generally keep the file open. They tend to open it, load
it into (virtual) memory, and then close it. When you save the file,
the editor opens the output file (which is either the original file or
a new file, depending upon the editor and how it is configured),
writes the data, then closes it. If the data was written to a new
file, it is then renamed with the original file name.
It would be possible to mmap() the file, but there isn't generally
much point in doing so. The data that text editors operate on isn't
generally the raw file contents.
--
Glynn Clements <[EMAIL PROTECTED]>