Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question

5 Answers 5

up vote 3 down vote accepted

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.

share|improve this answer

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 :)

share|improve this answer
Yep. I manually update software all the time while scripts are running. –  John T Jan 11 '10 at 18:18

What will happen to those running ruby processes?

  1. make a copy of /usr/local/bin/ruby
  2. [if it's not running, run /usr/local/bin/ruby ]
  3. try: rm /usr/local/bin/ruby
  4. and see for yourself :)
share|improve this answer

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.

share|improve this answer
That doesn't sound very efficient. I think Windows would memory-map it instead, so pages are loaded on demand. –  sashoalm May 9 '14 at 14:24

I remember demonstrating in 1992 to my former boss what is happening in case of one overwrites the executable file of a running process on SUNOS. On most UNIXs the process is going to crash. On HPUX one would get a sane response when trying to open an in use executable file for writing: "executable file busy". On NT this was always the case. That this problem is still the same today does not increase my confidence into people designing OSs. But what do you expect from people, which still don't understand the utility of a mandatory file lock.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.