【操作系统概念-作业10】Mass-Storage Systems

#! https://zhuanlan.zhihu.com/p/424678004
操作系统概念题图

【操作系统概念-作业10】Mass-Storage Systems

Operating System Concepts Exercises 10

Mass-Storage Systems

操作系统作业10

  • 10.4, 10.5
  • 10.9, 10.10, 10.11, 10.14

每题最后一个引用块是老师提供的参考答案

Practice Exercises

10.4, 10.5

10.4 Why is it important to balance file-system I/O among the disks and controllers on a system in a multitasking environment?

为什么在多任务环境中平衡文件系统在磁盘和控制器之间的I/O很重要?

答:

A system can perform only at the speed of its slowest bottleneck. Disks or disk controllers are frequently the bottleneck in modern systems as their individual performance cannot keep up with that of the CPU and system bus. By balancing I/O among disks and controllers, neither an individual disk nor a controller is overwhelmed, so that bottleneck is avoided.

一个系统只能以其最慢的瓶颈的速度运行。在现代系统中,磁盘或磁盘控制器经常成为瓶颈,因为它们的单个性能无法跟上CPU和系统总线的性能。通过在磁盘和控制器之间平衡I/O,单个磁盘或控制器都不会被压垮,因此可以避免瓶颈的出现。

10.5 What are the tradeoffs involved in rereading code pages from the file system versus using swap space to store them?

从文件系统中重读代码页与使用交换空间来存储代码页之间的权衡是什么?

答:

If code pages are stored in swap space, they can be transferred more quickly to main memory (because swap space allocation is tuned for faster performance than general file system allocation). Using swap space can require startup time if the pages are copied there at process invocation rather than just being paged out to swap space on demand. Also, more swap space must be allocated if it is used for both code and data pages.

如果代码页存储在交换空间中,它们可以更快地被转移到主内存中(因为交换空间的分配被调整为比一般文件系统分配更快的性能)。如果代码页是在进程调用时被复制到那里,而不是在需要时被分页到交换空间,那么使用交换空间可能需要启动时间。另外,如果交换空间同时用于代码和数据页,就必须分配更多的交换空间。

Exercises

10.9, 10.10, 10.11, 10.14

10.9 None of the disk-scheduling disciplines, except FCFS, is truly fair (starvation may occur).

除了FCFS之外,没有一个磁盘调度规则是真正公平的(可能会出现饥饿)。

a. Explain why this assertion is true.

解释为什么这个论断是真的。

答:

New requests for the track over which the head currently resides can theoretically arrive as quickly as these requests are being serviced.

理论上,对磁头当前所在轨道的新请求可以在这些请求得到服务的同时迅速到达。

b. Describe a way to modify algorithms such as SCAN to ensure fairness.

描述一种修改SCAN等算法以确保公平的方法。

答:

All requests older than some predetermined age could be “forced” to the top of the queue and an associated bit for each could be set to indicate that no new request could be moved ahead of these requests. For SSTF, the rest of the queue would have to be reorganized with respect to the last of these “old” requests.

所有超过预定年龄的请求可以被 "强制 "到队列的顶部,每个请求的相关位可以被设置,以表明没有新的请求可以被移到这些请求之前。对于SSTF来说,队列的其他部分将不得不根据这些 "老 "请求中的最后一个进行重新组织。

c. Explain why fairness is an important goal in a time-sharing system.

解释为什么公平性是分时系统的一个重要目标。

答:

保证所有响应得到应答,不会出现长时间等待。

To prevent unusually long response times.

d. Give three or more examples of circumstances in which it is important that the operating system be unfair in serving I/O requests.

举出三个或更多的例子,说明操作系统在为I/O请求提供服务时的不公平是很重要的。

答:

Paging and swapping should take priority over user requests.

It may be desirable for other kernel-initiated I/O, such as the writing of file system metadata, to take precedence over user I/O.

If the kernel supports real-time process priorities, the I/O requests of those processes should be favored.

分页和交换应该优先于用户请求。
其他由内核发起的I/O,例如文件系统元数据的写入,可能需要优先于用户I/O。
如果内核支持实时进程的优先级,这些进程的I/O请求应该被优先考虑。

10.10 Explain why SSDs often use an FCFS disk-scheduling algorithm.

答:

SSD没有磁头调度问题,随机读取所花费的时间是一样的

SSDs do not contain moving disk heads.

Some SSD schedulers merge only adjacent write requests, servicing all read requests in FCFS order.

SSD不包含移动的磁盘头。
一些SSD调度器只合并相邻的写请求,以FCFS的顺序服务所有的读请求。

10.11 Suppose that a disk drive has 5,000 cylinders, numbered 0 to 4,999.

The drive is currently serving a request at cylinder 2,150, and the previous request was at cylinder 1,805. The queue of pending requests, in FIFO order, is:

假设一个磁盘驱动器有5,000个柱区,编号为0到4,999。该硬盘目前正在为2,150缸的请求提供服务,前一个请求是在1,805缸。待处理的请求队列,按照先进先出的顺序,是

2,069, 1,212, 2,296, 2,800, 544, 1,618, 356, 1,523, 4,965, 3681

Starting from the current head position, what is the total distance (in cylinders) that the disk arm moves to satisfy all the pending requests for each of the following disk-scheduling algorithms?

从当前磁头位置开始,在以下每种磁盘调度算法中,磁盘臂为满足所有待处理请求而移动的总距离(以圆柱体为单位)是多少?

a. FCFS

The FCFS schedule is 2150, 2069, 1212, 2296, 2800, 544, 1,618, 356, 1,523, 4,965, 3681.

b. SSTF

The SSTF schedule is 2150,2069,2296,2800,3681,4965,1618,1523,1212,544,356.

c. SCAN

The SCAN schedule is 2150,2296,2800,3681,4965,4999,2069,1618,1523,1212,544,356.

d. LOOK

The LOOK schedule is 2150,2296,2800,3681,4965,2069,1618,1523,1212,544,356.

e. C-SCAN

The C-SCAN schedule is 2150,2296,2800,3681,4965,4999,0,356,544,1212,1523,1618,2069.

f. C-LOOK

The C-LOOK schedule is 2150,2296,2800,3681,4965,356,544,1212,1523,1618,2069.

计算结果:略

10.14 Describe some advantages and disadvantages of using SSDs as a caching tier and as a disk-drive replacement compared with using only magnetic disks.

描述与只使用磁性磁盘相比,使用固态硬盘作为缓存层和作为磁盘驱动器的替代品的一些优势和劣势。

答:

  • 优势:速度快,性能好

  • 劣势:缓存算法设计困难,易带来文件结构的混乱与文件恢复的困难

Advantages:

Faster than hard disk drives: SSDs have the advantage of being faster than magnetic disks as there are no moving parts and therefore do not have seek time or rotational latency.

An SSD is 25 to 100 times faster than a typical HDD. This translates to faster boot times, quicker file transfers, and greater bandwidth for enterprise computing.

Low power consumption, Compact and Durable than hard disk drives: This means that an SSD is suitable for energy efficient computers and consumer electronic devices

Disadvantages:

More expensive

Limited storage capacity

Shorter lifespan than hard disk drives: The flash memories of a solid-state drive can only be used for a finite number of writes.

An SSD cannot write a single bit of information without first erasing and then rewriting very large blocks of data at one time.

优点:

比硬盘驱动器更快。固态硬盘的优点是比磁性磁盘快,因为没有移动部件,因此没有寻道时间或旋转延迟。

SSD比典型的HDD快25到100倍。这意味着启动时间更快,文件传输更快,企业计算的带宽更大。

低功耗,比硬盘驱动器更紧凑和耐用。这意味着固态硬盘适用于节能的计算机和消费类电子设备。

缺点:

价格较高

存储容量有限

比硬盘驱动器的寿命更短。固态硬盘的闪存只能用于有限的写入次数。

如果不先擦除然后一次性重写非常大的数据块,固态硬盘就无法写入一个位的信息。


注:

翻译:deepl

参考资料:

[1] Operating System Concepts – 9th Edition 及其答案

  • 5
    点赞
  • 21
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

框架主义者

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值