《现代操作系统》精读与思考笔记 第四章 文件系统
本系列博文是《现代操作系统(英文第三版)》(Modern Operating Systems,简称MOS)的阅读笔记,定位是正文精要部分的摘录理解和课后习题精解,因此不会事无巨细的全面摘抄,仅仅根据个人情况进行记录和推荐。由于是英文版,部分内容会使用英文原文。
课后习题的选择标准:尽量避免单纯的概念考察(如:What is spooling?)或者简单的数值计算,而是能够引起思考加深理解的题目。为了保证解答的正确性,每道题都会附上原书解答,而中文部分会适当加入自己的见解。原书答案下载地址(需注册)
不巧的是,这章内容没有符合之前定位的内容,因此本文只包含了部分习题精解。
课后习题选
3.Is the open system call in UNIX absolutely essential? What would the consequences be of not having it?
译:
UNIX的open系统调用是必要的吗?如果没有会怎么样?
Answer:
To start with, if there were no open, on every read it would be necessary to specify the name of the file to be opened. The system would then have to fetch the i-node for it, although that could be cached. One issue that quickly arises is when to flush the i-node back to disk. It could time out, however. It would be a bit clumsy, but it might work.
分析:
如果没有open,那么每次对文件操作都要指定路径,之后操作系统还要寻找文件的i结点(即使被缓存)。何时回写i结点到磁盘也是个问题。
18.Name one advantage of hard links over symbolic links and one advantage of symbolic links over hard links.
译:
分别说出硬链接和符号链接各自优于对方的地方。
Answer:
Hard links do not require any extra disk space, just a counter in the i-node to keep track of how many there are. Symbolic links need space to store the name of the file pointed to. Symbolic links can point to files on other machines, even over the Internet. Hard links are restricted to pointing to files within their own partition.
分析:
硬链接不需要额外的磁盘空间,仅仅是在i结点的计数器上加一即可;符号链接需要保存指向的文件名,但可以指向其他机器甚至是网络上的文件。硬链接限制在自己的区域内。
勘误
1.P266,if(rd_count<=0) break;该行代码未对齐
2.P293计算方法与第三章习题27的答案计算方法不一致
3.习题11的答案977msec应为0.977msec
4.习题15,根据答案和图4-13,块大小应该为1024B而不是1024KB。这里暗含了个条件:i结点除了10个直接地址,还有一个指向地址的块,其中全部也是地址。
作者:五岳
出处:http://www.cnblogs.com/wuyuegb2312
对于标题未标注为“转载”的文章均为原创,其版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。