3/01/2010

03-01-10 - File Locks

There are so many dumb fucking things in our lives that we just get used to and accept and then don't even think about any more. But they're fucking dumb and we shouldn't let people get away with them.

The thing that's bugging me today is the way exe's are locked while they are running. WTF that's retarded, the whole thing is copied into RAM, there's no reason it needs to be kept on disk any more.

Of course it's standard practice when you're developing something to use something like run_prog.bat :


copy prog.exe prog_current.exe
prog_current %*

so that you can then still write prog.exe , but come on, this is fucking stupid.

In other similar stupidity : WTF I can't delete a directory just because I have an open CMD in that dir ? Just invalidate that path and let CMD handle it.

7 comments:

Jon Olick said...

Preach it!

Dave Moore said...

Most OSes don't copy the .exe into RAM, IIRC. They use the file on disk as backing for the page table entries covering the program text, and let page faults bring it into memory piecemeal.

That doesn't mean that they couldn't just let the ref in the pager keep the disk blocks from being GCed, and allow you to overwrite the file, though.

Autodidactic Asphyxiation said...

Windows file system handles are a level of indirection away from being good. Like, how do you do an atomic update on a file?

Tom said...

Dave Moore has it right: EXEs don't take up space in the page file. The relevant pages are backed by the image on disk. (DLLs work the same way. This is why rebasing DLLs can be a win: once rebased, the DLL can be backed by the .DLL file. Otherwise, it has to be loaded in and relocated, and the relocated code occupies page file space -- because it's been fixed up at runtime.)

I've been using Xcode on Mac OS X recently. Seems like you can recompile a program that's running, and it's no problem. Goddamn you Mac OS X! Goddamn you Xcode! You suck so much, and yet you are still better than Windows! Screw you!

Scott Graham said...

That pisses me off so much at work on Windows. The combo of Explorer and NTFS is complete ass. And ridiculously slow on top of it.

Brian said...

Works fine under Linux.

George McBay said...

The brain-dead file locking is one of my few remaining big problems with modern Windows.

Unix-alike systems have been far superior in this regard for a very long time.

old rants