Locking Executing Files: Windows does, Linux doesn't. Why?

前端 未结 8 1592
有刺的猬
有刺的猬 2020-12-04 09:18

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

8条回答
  •  时光说笑
    2020-12-04 10:19

    I think you're too absolute about Windows. Normally, it doesn't allocate swap space for the code part of an executable. Instead, it keeps a lock on the excutable & DLLs. If discarded code pages are needed again, they're simply reloaded. But with /SWAPRUN, these pages are kept in swap. This is used for executables on CD or network drives. Hence, windows doesn't need to lock these files.

    For .NET, look at Shadow Copy.

提交回复
热议问题