Executable File Locks Unnecessary?
I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified. Linux, on the other hand, does not lock executing files and you can delete, move, or modify them. Why does Windows lock when Linux does not? Is there an advantage to locking?Can Windows 7 drop executable file locking?
January 22nd, 2009 6:46pm

How do I do that?
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2009 12:48am

How do you do what? Click that link, or send a comment to developers in that thread?Rating posts helps other users Mark L. Ferguson MS-MVP
February 17th, 2009 1:06am

How do I send my request to the development team in this thread? I don't know who the development team is or how to contact them.I clicked on the "Have comments about Windows 7 Beta", but it didn't look like the appropriate place (non-technical, and I didn't notice and developers responding).
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2009 1:12am

David Lenihan said: I noticed when a file is executed on Windows (.exe or .dll), it is locked and cannot be deleted, moved or modified. Linux, on the other hand, does not lock executing files and you can delete, move, or modify them. Why does Windows lock when Linux does not? Is there an advantage to locking?Can Windows 7 drop executable file locking? The simple answer... Windows uses file/record locking on open files because that file may not be completely loadedinto memory - and as such, the application may need other bits of itself at some other point of it's execution. Should the file be unlocked and subsequently deleted whilethe app istrying to read the next bits, what you'd wind up with is a crash.It's common sense. Why would you want to delete an app that's running anyhow?
February 17th, 2009 1:22am

>> Why would you want to delete an app that's running anyhow?If you are doing app development, you can't build a new version of an application until you close all running instances.On Linux, we don't have to do this. You can have two different versions of the same executable running side by side.I develop for Windows and Linux. I'm showing Linux guys how to develop on Windows and this issue came up ("How come my build fails during linking?"). On Linux, you don't have to worry if an app is running or not...just delete it and everything works fine.I want to know why Windows can't do the same thing.The Linux guys want to say it is because Windows is inferior to Linux, but I don't believe it. I'm guessing there must be a performance reason, but I haven't got a good answer yet.I'll take performance over convenience if that is the case...if not, then I like the Linux model better because the OS stays out of your way from doing what you want to do.
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2009 1:33am

We just have a different way of doing things - seehttp://msdn.microsoft.com/en-us/library/bb540533(VS.85).aspx. In the Windows world, when a process is running or a file/library has a handle to it, it cannot be deleted. It's not for performance reasons, it's just an architectural decision. It will not be changed (after 20 years of expected behavior the backwards compatibility ramifications are staggering) so filing feedback on this is probably not worth the time. Any more than Unix/Linux will not change the concept of having case sensitive file systems that are a huge usability problem with most end users. Too much inertia.Ned Pyle [MSFT] - MS Enterprise Platforms Support - Beta Team
February 17th, 2009 8:28am

Thanks for the reply Ned.I still don't understand the advantage of this architectural choice to lock files. Is there an advantage to locking or is it just backward-compatible baggage?Thanks,David
Free Windows Admin Tool Kit Click here and download it now
February 17th, 2009 9:17am

I can easily see the reasons for file locks. It would be too easy for a malicious writer to query what applications and services are running and then replace the actual executable with a malicious version using the same file name. A file lock will deter (not necessarily prevent) this kind of simple behavior. Also, file locks protect end userswho are not developers or power usersfrom themselves as they may not know the ramifications of their actions. Heck, there was a post in another Win7 beta forum of a user who deleted some .NET Framework files and is now having a hard time getting his system to work properly. What seems to be a great feature in Linux can be a downfall. Even logged in as a local administrator on a Windows box, you cant just delete the c:\windows\system32 folder. Windows is going to scream at you. However, in Linux while logged in as root (no, you should not be logged in as root, but that is beside the case in this example) or issuing a sudo command, the user could easily delete /etc with a sift rm * -rf command. Good bye OS.
February 17th, 2009 6:41pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics