Linux, unlike Windows, will let you delete a file that is actively in use. It removes the reference on the file system but the contents of the file won’t be deleted until all file pointers to it close. In fact it will still be seen as taking up disk space until it’s garbage collected (deleting a large file that’s in use can be frustrating).
So the file is actually still available to that running process. If you replace it with a new executable and run that then you get the new version.
It’s a bit more interesting than that…
Linux, unlike Windows, will let you delete a file that is actively in use. It removes the reference on the file system but the contents of the file won’t be deleted until all file pointers to it close. In fact it will still be seen as taking up disk space until it’s garbage collected (deleting a large file that’s in use can be frustrating).
So the file is actually still available to that running process. If you replace it with a new executable and run that then you get the new version.