Let's say /usr/local/bin/ruby is running in the background, and then we overwrite ruby with a different version, or even delete ruby.
What will happen to those running ruby processes?
|
feedback
|
|
It depends on exactly how the executable is updated. If the same file is opened and parts of it are changed, bad things will happen. If it is removed, the file is removed from the directory structure of the filesystem, but not actually unlinked (i.e., deleted) until the last process that has it open has executed it exits. So if the executable is removed and a new one with the same name written in its place, the old one should continue to work ok. | |||
|
feedback
|
|
They'll keep on going. Maybe crash horribly if they try and access themselves and receive something utterly wrong. I wouldn't do it unless I had to :) | |||
feedback
|
| |||
|
feedback
|
|
It is my understanding that the Linux kernel has a component called the loader that opens the executable file itself, containing the image, during the loading/linking process, and once done with linking to libraries, etc., the loader closes the file. Thus, this process happens and is complete by the time the kernel actually launches the process. I'm not sure if the original executable on disk needs to be referenced if the executable later tries to import external libraries. I would say, and it's been my experience that, if you delete the executable on disk, the executable loaded in memory isn't affected. Likewise, if the executable file is replaced with a newer versions, currently executing ones aren't "automatically" updated unless they are halted and relaunched. I had issues with a RAID controller that caused the entire disk that the root directory and other partitions was mounted on to suddenly act as though it was disconnected. Couldn't load new programs, but ones in memory were working fine, until they needed files from the disk. | |||
|
feedback
|