为什么在多用户系统中仅仅文件锁定还不够?
里奇声称,文件锁定不足以防止编辑器等程序在编辑时复制文件,然后在完成后写入原始文件所造成的混乱。你能解释一下他的意思吗?
Ritchie claims that file locking is not sufficient to prevent the confusion caused by programs such as editors that make a copy of a file while editing and then write the original file when done. Can you explain what he meant?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
他还表示锁不是必需的,大多数工程师认为这种说法是不真实的。
这是由 DM Ritchie 和 K. Thompson 撰写的《The UNIX Time-Sharing System》,收录于《The Bell System Technical Journal》,第 1 卷。 57,第 6 期(1978 年 7 月至 8 月),第 2 部分,第 1905-1929 页。
言论的上下文提到了根据操作系统的目的需要锁定。这是 Unix v6(也许更早)文件系统提供文件锁定的时代。由于文件系统不面对大型可更新数据库,因此锁定不够。
没有必要,因为系统内核通过锁管理内部数据结构,并且如果两个写入者同时操作同一个文件,系统会保持“逻辑一致性”。我认为后者主要指附加到 stdout 或 stderr 的多个进程。
He also said locks were not necessary, an assertion which most engineers consider to be untrue.
This was written by D.M. Ritchie and K. Thompson, The UNIX Time-Sharing System in The Bell System Technical Journal, Vol. 57, No. 6 (July-August 1978), Part 2, pp. 1905-1929.
The context of the remarks referred to the need for locking per the operating system's purposes. This was the era of Unix v6 (and maybe earlier) filesystems to provide file locking. Since the filesystem was not faced with large updateable databases, locking was not sufficient.
It was not necessary since the system kernel managed internal data structures with locks, and the system maintained "logical consistency" if two writers operated on the same file at once. I think the latter refers primarily to multiple processes appending to stdout or stderr.