11.1 Is disk scheduling, other than FCFS scheduling, useful in a single-user environment? Explain your answer.
在单用户环境中,I/O队列通常为空。对于一个块或一系列连续块,请求通常来自单个process。在这些情况下,FCFS是一种经济的磁盘调度方法。但LOOK几乎同样易于编程,并且在多个process执行并发I/O时,会提供更好的性能,例如当Web浏览器在后台检索数据,而作业系统正在分页,而另一个应用程序在前台处于活动状态时。
11.2 Explain why SSTF scheduling tends to favor middle cylinders over the innermost and outermost cylinders.
盘的中心是到所有其他磁道的平均距离最小的位置。因此,磁头倾向于远离磁盘边缘。这是另一种思考方式。缸盖的当前位置将磁道分为两组。如果磁头不在磁盘的中心,并且新请求到达,则新请求更有可能位于包含磁盘中心的组中;因此,头部更有可能朝该方向移动。
11.3 Why is rotational latency usually not considered in disk scheduling? How would you modify SSTF, SCAN, and C-SCAN to include latency optimization?
大多数磁盘不会将其旋转位置信息导出到主机。即使他们这样做了,这些信息到达调度器的时间也不精确,并且调度器消耗的时间是可变的,因此旋转位置信息将变得不正确。此外,磁盘请求通常以术语形式给出逻辑块编号,并且逻辑块和物理位置之间的映射非常複杂。
11.4 Why is it important to balance file-system I/O among the disks and controllers on a system in a multitasking environment?
系统只能以其最慢瓶颈的速度执行。磁盘或磁盘控制器通常是现代系统中的瓶颈,因为它们的性能无法与CPU和系统总线的性能相媲美。通过平衡磁盘和控制器之间的I/O,单个磁盘和控制器都不会被淹没,从而避免了瓶颈。
11.5 What are the tradeoffs involved in rereading code pages from the file system versus using swap space to store them?
如果代码页存储在交换空间中,则可以更快地将其传输到主存(因为交换空间分配的性能比一般的文件系统分配更快)。如果页面是在进程调用时復製到那里的,而不仅仅是按需调出以交换空间,那麽使用交换空间可能需要启动时间。
此外,如果交换空间同时用于代码页和数据页,则必须分配更多的交换空间
11.6 Is there any way to implement truly stable storage? Explain your answer
真正稳定的存储永远不会丢失数据。稳定存储的基本技术是维护数据的多个副本,这样,如果一个副本被销毁,另一个副本仍然可以使用。但对于任何计划,我们都可以想像一场大到足以摧毁所有副本的灾难。
11.7 It is sometimes said that tape is a sequential-access medium, whereas a hard disk is a random-access medium. In fact, the suitability of a storage device for random access depends on the transfer size. The term streaming transfer rate denotes the rate for a data transfer that is underway, excluding the effect of access latency. In contrast, the effective transfer rate is the ratio of total bytes to total seconds, including overhead time such as access latency. Suppose we have a computer with the following characteristics: the level-2 cache has an access latency of 8 nanoseconds and a streaming transfer rate of 800 megabytes per second, the main memory has an access latency of 60 nanoseconds and a streaming transfer rate of 80 megabytes per second, the hard disk has an access latency of 15 milliseconds and a streaming transfer rate of 5 megabytes per second, and a tape drive has an access latency of 60 seconds and a streaming transfer rate of 2 megabytes per second.
a. Random access causes the effective transfer rate of a device to decrease, because no data are transferred during the access time.For the disk described, what is the effective transfer rate if an average access is followed by a streaming transfer of (1) 512 bytes, (2) 8 kilobytes, (3) 1 megabyte, and (4) 16 megabytes?
b. The utilization of a device is the ratio of effective transfer rate to streaming transfer rate. Calculate the utilization of the disk drive for each of the four transfer sizes given in part a.
c. Suppose that a utilization of 25 percent (or higher) is considered acceptable. Using the performance figures given, compute the smallest transfer size for a disk that gives acceptable utilization.
d. Complete the following sentence: A disk is a randomaccess device for transfers larger than bytes and is a sequential-access device for smaller transfers.
e. Compute the minimum transfer sizes that give acceptable utilization for cache, memory, and tape.
f. When is a tape a random-access device, and when is it a sequential-access device?
a、 对于512字节,有效传输速率计算如下。
ETR=传输大小/传输时间。
如果X是传输大小,则传输时间是((X/STR)+延迟)。
传输时间为15ms+(每秒512B/5MB)=15.0097ms。
因此,有效传输速率为512B/15.0097ms=33.12 KB/s。
8KB的ETR=.47MB/秒。
1MB的ETR=4.65MB/sec。
16MB的ETR=4.98MB/sec。
b、 512B的设备利用率=33.12 (KB/s) / 5(MB/s)=0.0064=0.64%
对于 8KB=9.4%
对于1MB=93%。
对于16MB=99.6%。
c、 计算。25=ETR/STR,求解传输大小X。
STR=5MB,因此1.25MB/S=ETR。
1.25MB/S*((X/5)+。015)=X。
0.25X + .01875 = X
X=0.025MB。
d、 磁盘是用于传输大于K字节(其中K>磁盘区块大小)的随机访问设备,也是用于传输较小的顺序访问设备。
e、 计算可接受的缓存利用率的最小传输大小:
STR=800MB,ETR=200,延迟=8*10−9
200(XMB/800+8 X 10−9) =XMB。
0.25XMB+1600*10−9=XMB。
X=2.24bytes。
计算内存:
STR=80MB,ETR=20,L=60*10-9。
20(XMB/80+60*10-9)=XMB。
0.25XMB+1200*10−9=XMB。
X=1.68bytes。
计算磁带:
STR=2MB,ETR=0.5,L=60。
0.5(XMB/2+60)=XMB。
0.25XMB+30=XMB。
X=40MB。
f. 这取决于它的使用方式。假设我们正在使用磁带恢復备份。在本例中,我们依次读取磁带的内容,磁带充当循序存取设备。作为另一个示例,假设我们使用磁带访问存储在磁带上的各种记录。在这种情况下,对磁带的访问是任意的,因此被认为是随机的。
11.8 Could a RAID level 1 organization achieve better performance for read requests than a RAID level 0 organization (with nonredundant striping of data)? If so, how?
是的,RAID级别1组织可以实现更好的读取请求性能。执行读取操作时,RAID级别1系统可以决定应访问块的两个副本中的哪一个以满足请求。此选择可能基于磁头的当前位置,因此可以通过选择更接近目标数据的磁头来实现性能优化.
11.9 Give three reasons to use HDDs as secondary storage.
HDD仍然是最常见的辅助存储设备。
a、 它们是同价格中最大的随机存取存储设备,以低成本提供TB级的储存。
b、 从外部外壳到存储阵列,许多设备都是设计给于HDD,提供多种使用HDD的方式。
c、 它们在整个生命週期保持相同的读写性能与NVM存储设备不同,NVM存储装置在get full和老化时会失去写入性能。
11.10 Give three reasons to use NVM devices as secondary storage.
NVM设备的尺寸增加和价格下降速度比HDDs快。
a、 高速NVM设备(包括SSD,通常不包括USB驱动器)比HDD快得多。辅助存储器速度对整个系统性能有很大影响。
b、 NVM设备比HDD耗电更少,因此非常好用用于笔记型电脑和其他便携式电池供电设备。NVM设备也可以比HDD小得多。
c、 因为NVM设备没有活动部件,所以它们往往比HDD更可靠。
11.11 None of the disk-scheduling disciplines, except FCFS, is truly fair (starvation may occur).
a. Explain why this assertion is true.
b. Describe a way to modify algorithms such as SCAN to ensure fairness.
c. Explain why fairness is an important goal in a multi-user systems.
d. Give three or more examples of circumstances in which it is important that the operating system be unfair in serving I/O requests.
a.除了FCFS其他调度算法都是抢占式的调度算法,当不断有新的靠近磁头的调度请求出现时,远离磁头的调度请求就会飢饿。
b.设置一个定时器,所有超过固定时长的调度请求被安排到等待队列队首。
c.分时系统要求计算机能够快速响应所有用户的请求,所以要避免某些用户的process因为不公导致长时间等待。
d.内核的IO请求优先于用户的IO请求;高优先级进程的IO请求优先于低优先级的进程IO请求;分页和交换优先于用户IO请求
11.12 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:
2,069; 1,212; 2,296; 2,800; 544; 1,618; 356; 1,523; 4,965; 3,681
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
b. SCAN
c. C-SCAN
a. The FCFS schedule is 2,150; 2,069; 1,212; 2,296; 2,800; 544; 1,618; 356; 1,523; 4,965; 3,681 The total seek distance is 13,011.
b. The SCAN schedule is 2,150; 2,296; 2,800; 3,681; 4,965; 2,069; 1,618; 1,523; 1,212; 544, 356. The total seek distance is 7,492.
c. The C-SCAN schedule is 2,150; 2,296; 2,800; 3,681; 4,965; 356; 544; 1,212; 1,523; 1,618; 2,069. The total seek distance is 9,917.
11.13 Compare and contrast HDDs and NVM devices. What are the best applications for each type?
HDD特点:大容量、低成本、一致的读写在整个生命週期,许多存储设备设计为集成,在需要大容量和成本比性能更重要时有用。
NVM的特点:容量更小,成本更高,速度更快,更可靠,写入性能变化,体积更小,功耗更低。在性能、电池寿命或可靠性最重要的情况下非常有用
11.14 Compare the performance of C-SCAN and SCAN scheduling, assuming a uniform distribution of requests. Consider the average response time (the time between the arrival of a request and the completion of that request’s service), the variation in response time, and the effective bandwidth. How does performance depend on the relative sizes of seek time and rotational latency?
There is no simple analytical argument to answer the first part of this question. It would make a good small simulation experiment for students. The answer can be found in Figure 2 of Worthington et al. [1994]. (Worthington et al. studied the LOOK algorithm, but similar results obtain for SCAN.) The figure shows that C-LOOK has an average response time just a few percent higher than LOOK but that C-LOOK has a significantly lower variance in response time for medium and heavy workloads. The intuitive reason for the difference in variance is that LOOK (like SCAN) tends to favor requests near the middle cylinders, whereas the C-versions do not have this imbalance. The intuitive reason for the slower response time of C-LOOK is the “circular” seek from one end of the disk to the farthest request at the other end. This seek satisfies no requests. It causes only a small performance degradation because the square-root dependency of seek time on distance implies that a long seek isn’t terribly expensive by comparison with moderate-length seeks. For the second part of the question, we observe that these algorithms do not schedule to improve rotational latency; therefore, as seek times decrease relative to rotational latency, the performance differences between the algorithms will decrease.
11.15 Consider a RAID level 5 organization comprising five disks, with the parity for sets of four blocks on four disks stored on the fifth disk. How many blocks are accessed in order to perform the following?
a. A write of one block of data
b. A write of seven continuous blocks of data
a、 写入一个资料区块需要执行以下操作:读取同位区块,读取储存在目标块中的旧资料,计算新基于目标块的新内容和旧内容的同位位元,以及同位的写入区块和目标区块。
b.假设七个连续的区块开始于一个四个区块边界。写入七个连续的资料块可以通过写七个连续的块来执行,写前四个区块的同位位元区块,读取第八个区块, 计算下一组四个区块的同位位元并写入相对应的同位位元区块到磁碟上。
11.16 Assume that you have a mixed configuration comprising disks organized as RAID level 1 and RAID level 5 disks. Assume that the system has flexibility in deciding which disk organization to use for storing a particular file. Which files should be stored in the RAID level 1 disks and which in the RAID level 5 disks in order to optimize performance?
经常更新的数据需要储存在RAID 1级磁碟上,而与写入数据相比,更频繁读取的数据应该存储在RAID级别5磁碟中。
11.17 The reliability of a storage device is typically described in terms of mean time between failures (MTBF). Although this quantity is called a “time,” the MTBF actually is measured in drive-hours per failure.
a. If a system contains 1,000 disk drives, each of which has a 750,000- hour MTBF, which of the following best describes how often a drive failure will occur in that disk farm: once per thousand years, once per century, once per decade, once per year, once per month, once per week, once per day, once per hour, once per minute, or once per second?
b. Mortality statistics indicate that, on the average, a U.S. resident has about 1 chance in 1,000 of dying between the ages of 20 and 21. Deduce the MTBF hours for 20-year-olds. Convert this figure from hours to years. What does this MTBF tell you about the expected lifetime of a 20-year-old?
c. The manufacturer guarantees a 1-million-hour MTBF for a certain model of disk drive. What can you conclude about the number of years for which one of these drives is under warranty?
a.每次故障 750,000 drive小时数除以 1,000 个drive得出 750 每次故障的小时数——大约 31 天,或每月一次。
b.我们可以将每次故障的人工小时数计算为 8,760(小时/年)除以 0.001 故障,得到 8,760,000“小时”的值平均无故障时间; 8,760,000 小时等于 1,000 年。这告诉我们与 20 岁的人的预期寿命无关。
c. MTBF没有说明预期寿命。硬碟drives通常设计为具有五年的使用寿命。如果这样的drive真的有百万小时的 MTBF,驱动器不太可能的在其预期使用寿命内发生故障。
11.18 Discuss the reasons why the operating system might require accurate information on how blocks are stored on a disk. How could the operating system improve file-system performance with this knowledge?
在为档案分配区块时,作业系统可以分配有更多关于磁碟上区块的物理位置的资讯与在磁碟上几何接近的区块。 特别是,它可以分配一个资料块,然后在同一个磁柱中分配第二个资料块但在不同表面的旋转最佳位置,以便以最低成本进入下一个区块。