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

前端 未结 8 1540
有刺的猬
有刺的猬 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:24

    As far as I know, linux does lock executables when they're running -- however, it locks the inode. This means that you can delete the "file" but the inode is still on the filesystem, untouched and all you really deleted is a link.

    Unix programs use this way of thinking about the filesystem all the time, create a temporary file, open it, delete the name. Your file still exists but the name is freed up for others to use and no one else can see it.

提交回复
热议问题