现代操作系统第四版第四章部分习题(英文)

绝大部分是上课期间的作业,可能后续会有补充,也可能没有
部分内容有参考(包括博客,随书的参考资料,课程资料等等),部分内容是自己写的

另,因为课程要求,所以作为作业上交的部分是用英文完成的,后续补充用英文还是中文看心情叭hhh
操作系统的初学者,如有疏漏或错误,欢迎指正 (^ _ ^)

5.Systems that support sequential files always have an operation to rewind files. Do systems that support random-access files need this, too?
No. If you want to read the file again, just randomly access byte 0.

6.Some operating systems provide a system call rename to give a file a new name. Is there any difference at all between using this call to rename a file and just copying the file to a new file with the new name, followed by deleting the old one?
Yes. The rename call does not change the creation time or the time of last modification, but creating a new file causes it to get the current time as both the creation time and the time of last modification. Also, if the disk is full, the copy might fail.

8.A simple operating system supports only a single directory but allows it to have arbitrarily many files with arbitrarily long file names. Can something approximating a hier- archical file system be simulated? How?
Use file name such as /usr/ast/file. While it looks like a hierarchical path name, it is really just a single name containing embedded slashes.

35.Consider a disk that has 10 data blocks starting from block 14 through 23. Let there be 2 files on the disk: f1 and f2. The directory structure lists that the first data blocks of f1 and f2 are respectively 22 and 16. Given the FAT table entries as below, what are the data blocks allotted to f1 and f2?
(14,18);(15,17); (16,23); (17,21); (18,20); (19,15); (20, −1); (21, −1);(22,19); (23,14). In the above notation, (x, y) indicates that the value stored in table entry x points to data block y.

f1:22,19,15,17,21
f2:16,23,14,18,20

37.A certain file system uses 4-KB disk blocks. The median file size is 1 KB. If all files were exactly 1 KB, what fraction of the disk space would be wasted? Do you think the wastage for a real file system will be higher than this number or lower than it? Explain your answer.
The fraction of the wasted disk space is:1KB/2KB*100%=50%
In practice, every file system has large files as well as many small ones, and these files use the disk much more efficiently. For example, a 32769-byte file would use 17 disk blocks for storage, given a space efficiency of 32768/34861, which is about 94%.

41.How many disk operations are needed to fetch the i-node for a file with the path name /usr/ast/courses/os/handout.t? Assume that the i-node for the root directory is in memory, but nothing else along the path is in memory. Also assume that all directories fit in one disk block.
The following disk reads are needed:

  1. directory for /
  2. i-node for /usr
  3. directory for /usr
  4. i-node for /usr/ast
  5. directory for /usr/ast
  6. i-node for /usr/ast/course
  7. directory for /usr/course
  8. i-node for /usr/ast/course/os
  9. directory for /usr/course/os
  10. i-node for /usr/ast/course/os/handout.t
    In total, 10 disk reads are required.
表情包
插入表情
评论将由博主筛选后显示,对所有人可见 | 还能输入1000个字符
相关推荐
©️2020 CSDN 皮肤主题: 游动-白 设计师:白松林 返回首页