为什么在多用户系统中仅仅文件锁定还不够?

发布于 2024-08-18 10:27:05 字数 67 浏览 3 评论 0原文

里奇声称,文件锁定不足以防止编辑器等程序在编辑时复制文件,然后在完成后写入原始文件所造成的混乱。你能解释一下他的意思吗?

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

脸赞 2024-08-25 10:27:05

他还表示锁不是必需的,大多数工程师认为这种说法是不真实的。

这是由 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文