2

I have a code in fortran which I compiled and then sent to run as a pbs job in a supercomputer. I want to modify the source code and compile it again while keeping the already running program. My question is what happens if I modify the source code and make a new executable if I have a pbs job running with a different executable. Would the results from the original executable be modified?

Thanks.

armando
  • 1,360
  • 2
  • 13
  • 30

1 Answers1

7

If the replacement of the executable happens atomically with the rename() system call, then it should work such that the running program keeps using the old executable. OTOH if the replacement happens by writing bits and pieces into the existing executable, the running executable might be affected.

FWIW, this has nothing to do with fortran, pbs, nor torque, but rather to do with POSIX filesystem semantics. POSIX filesystems are essentially reference-counted object stores, with delete-on-last-close. When you replace the executable with rename(), the reference count of the old executable is reduced by one since the directory no longer has a reference to it. However, the executing program still holds a reference and can keep using it. The new executable is a separate object with it's own reference count.

janneb
  • 36,249
  • 2
  • 81
  • 97