If the executable code in the file should be blocked or not, this is a design decision, and MS just decided to block it, since in practice it has obvious advantages: in this way you do not need to know which code, which version the application is used in. This is a serious problem with the default behavior of Linux, which is simply ignored by most people. If you replace the system libraries, you cannot easily find out which applications use the code of such libraries; in most cases, the best you can get is that the package manager knows some users of these libraries and restarts them. But this only works for common and well-known things, such as maybe Postgres and its libraries or such. More interesting scenarios are if you are developing your own application against some third-party libraries, and they are replaced, because most of the time the package manager simply does not know your application. And this is not only a problem with native C code or something, it can happen with almost everything: just use httpd with mod_perl and some Perl libraries installed using the package manager, and let the package manager update these Perl libraries for any reason. It will not restart your httpd, simply because it does not know the dependencies. There are many examples like this, simply because any file can potentially contain code used in memory by any runtime, think of Java, Python, and all such things.
Thus, there is good reason to believe that locking files by default may be a good choice. However, you do not have to agree with these reasons.
So what did MS do? They simply created an API that allows the calling application to decide whether files should be locked or not, but they decided that the default value of this API was to provide an exclusive lock for the first calling application. See the API on CreateFile and its dwShareMode argument. It is for this reason that you will not be able to delete files used by some applications, it just does not apply to your use case, uses the default values โโand, therefore, receives an exclusive Windows lock for the file.
Please do not believe that people tell you something that Windows does not use ref counting on HANDLE or does not support Hardlinks or something like that, this is completely wrong. Nearly every API that uses HANDLEs documents their reference counting behavior, and you can easily read almost any NTFS article that actually supports Hardlinks and has always run because Windows Vista also supports Symlinks, and support for Hardlinks has improved by providing an API for read all hard links for a given file , etc.
In addition, you may just want to take a look at the structures used to describe the file, for example. Ext4 compared to NTFS , which have a lot in common. Both work with the concept of extents, which separates data from attributes such as the file name, and inodes is just another name for an older but similar concept. Even Wikipedia lists both file systems in an article.
There really are a lot of FUDs around locking files in Windows compared to other OSs on the network, as is defragmentation. ;-) Some of these FUDs can be eliminated by simply reading a bit on Wikipedia .