minix3 文件系统实现
我刚刚浏览了操作系统:设计和实现的第5.3节:“文件系统实现”,并且我对使用链表(表实现)进行磁盘管理有疑问。
作者提到,使用表实现每个表条目占用 3 个字节,这是可以理解的。然而,还提到可以通过每个表条目使用 4 个字节来执行时间优化。
这种优化是如何进行的?
I was just going through section 5.3 of Operating Systems: Design and Implementation: "File system implementation", and I have a doubt regarding disk management using linked lists (table implementation).
The authors mention that using the table implementation takes up 3 bytes per table entry, and this is understandable. However, it is also mentioned that an optimization for time can be performed by using 4 bytes per table entry.
How does that optimization work?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许 4 个字节是架构的字大小,所以 CPU 可以立即用这些值进行算术?对于 3 字节值,您可能需要进行一些操作才能将它们扩展为 4 字节,然后才能对这些值进行操作。
话虽这么说,与内存相比,CPU 的速度非常快,更不用说磁盘和带宽了,所以如果 3 字节版本在实践中更快,我不会感到惊讶。
Perhaps 4 bytes is the word size of the architecture, so the CPU can immediately do arithmetic with those values? With 3 byte values, you presumably need to do some bit twiddling to expand them to 4 bytes before you can operate on the values.
That being said, CPU's are very very fast compared to memory, not to mention disk, bandwidth, so I wouldn't be surprised if the 3 byte version is faster in practice.