Answer the question
In order to leave comments, you need to log in
Why can an application uninstall itself on Linux, but not on Windows?
On Windows, when an application tries to delete its executable file, we get a "file is in process" error, but on Linux it doesn't (at least the console utility written based on .NET Core was able to demolish all its files without throwing an exception).
I would like to understand the difference in approaches.
Answer the question
In order to leave comments, you need to log in
When a process opens a file, it opens a handle to a particular data structure. This structure contains the file's attributes, permissions, information about where the file's data is stored, and so on.
In Win and *nix, this information is stored in different places, and, accordingly, the lock occurs in different ways.
On POSIX systems (unix, linux, etc.) the information about the file is stored by the iNode, and the file name already refers to the iNode.
In Windows and DOS, information about a file was originally stored in a structure called a Directory Entry. In NTFS, this has changed a little, but they did not change the approach, either for backward compatibility, or did not see the need for it.
Actually, it historically grew from here that in * nix, when opening a file, the descriptor points to an iNode, and the file name itself can be freely deleted at the same time, or you can make several names referring to one iNode (hard link), which can be arbitrarily changed while "the file is open ".
In Windows, the Directory Entry (or its analogue in NTFS) is locked directly, therefore it cannot be modified at this moment.
Both approaches have their pros and cons and history. So far, there are no prerequisites for the fact that they want to change the approach on Windows.
Because on Windows the filename is nailed to the file itself, while on Linux the name is just an entry in a directory file. There was a great article about this on Habré many years ago, but now I am not able to find it.
on Linux, when an application (file) is deleted, it remains in RAM until the process is rebooted or stopped. Windows, on the other hand, closes all associated processes (or tries to) and deletes a file that is no longer executable.
So you can delete all root directories in Linux and the system will work, but when you reboot it will not start.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question