I always wonder how pacman (or linux package system in general) resolve this issue. In windows, the program has to be restarted or whatsoever. In arch howerver, I once had zsh (shell) v4 running on a terminal, then I upgraded zsh to v5 in another terminal, after that, at the first terminal, I tried zsh --version and it says 5, lol, how could this happen ? is zsh spawning a new process ? if that's the case how can the old zsh still able to run and process command ? is it loaded fully into memory before so the file in hdd can safely be replaced ? then how about a package that has several /lib dependency, if the /lib is upgraded, can the program continue to run ? And how about a program that's heavily being used, let say mysql, and then updated while running, is that possible ? Is pacman storing the upgraded files somewhere then inject those when program is not being used ? or inject it when the computer starts / shutdown (like windows update) via initscrips or something, is there any standard on resolving this issue across many package manager available for linux ?
I'm puzzed with this. Sorry if my explanation isn't clear
It is a matter of operating system, not of distribution.
On linux every file that is open from an application will be accessible to it, even if deleted from disk.
On windows it will be locked and you can't do much on that file until the application has released it.
Yes, when writing zsh --version, then you're spawning a new /bin/zsh process.
The upgrades relates to files on disk and not what's currently loaded into memory, and hence, sometimes problems can occure on big updates where e.g. dynamic libs change name/locations...
When you open a file, the kernel follows the link, and assigns the inode a file descriptor (a number that it keeps track of internally). When you delete the file, you are "unlinking" the inode; the file descriptor still points to it. You can create a new file with the exact same name as the old file after deleting it, effectively "replacing" it, but it will point to a different inode. Any programs that still have the old file open can still access the old file via the file descriptor, but you have effectively upgraded the program in place. As soon as the program terminates (or closes the file), and starts up (or tries to access it again), it accesses the new file, and there you have it, a completely in-place replacement of a file!
(stolen from Why linux can be updated without rebooting)
systemd is like pacman. enjoys eating up stuff.
That's it !, thx very much @all