现代操作系统期末突击

第五章 I/O

13. Explain how an OS can facilitate installation of a new device without any need for
recompiling the OS.

对每种设备类型,操作系统定义一组驱动程序必须支持的函数。驱动程序通常包含一张table,具有这些函数指向驱动程序自身的指针。当新的驱动程序装载时,操作系统记录这张表格的地址,在表中新建一个条目,并将指向驱动程序的函数指针填入。

28. Consider a magnetic disk consisting of 16 heads and 400 cylinders. This disk has four
100-cylinder zones with the cylinders in different zones containing 160, 200, 240. and
280 sectors, respectively. Assume that each sector contains 512 bytes, average seek
time between adjacent cylinders is 1 msec, and the disk rotates at 7200 RPM. Calculate
the (a) disk capacity, (b) optimal track skew, and (c) maximum data transfer rate.

容量(disk capacity): 磁头数*柱面数*扇区数

Capacity of zone 1: 16 × 100 × 160 × 512 = 131072000 bytes
Capacity of zone 2: 16 × 100 × 200 × 512 = 163840000 bytes
Capacity of zone 3: 16 × 100 × 240 × 512 = 196608000 bytes
Capacity of zone 4: 16 × 100 × 280 × 512 = 229376000 bytes
Sum = 131072000 + 163840000 + 196608000 + 229376000 = 720896000

最优磁道斜进(中文书p211): 寻道时间/通过每个扇区需要的时间

A rotation rate of 7200 means there are 120 rotations/sec.
In the 1 msec track-to-track seek time, 0.120 of the sectors are covered.//1ms转0.12圈
//4个柱面通过每个扇区需要的时间不同,分别计算
In zone 1, the disk head will pass over 0.120 × 160 sectors in 1 msec, so, optimal track
skew for zone 1 is 19.2 sectors. 

In zone 2, the disk head will pass over
0.120 × 200 sectors in 1 msec, so, optimal track skew for zone 2 is 24 sectors.

In zone 3, the disk head will pass over 0.120 × 240 sectors in 1 msec,
so, optimal track skew for zone 3 is 28.8 sectors. 

In zone 4, the disk head will pass over 0.120 × 280 sectors in 1 msec, so, optimal track skew for
zone 3 is 33.6 sectors.

最大数据传输率:
数据传输率=转速扇区数每个扇区的大小
4个柱面转速相同,每个扇区的大小相同,那么扇区数选最大的:120280512=17203200 Byte/s

31. Disk requests come in to the disk driver for cylinders 10, 22, 20, 2, 40, 6, and 38, in
that order. A seek takes 6 msec per cylinder. How much seek time is needed for
(a) First-come, first served.
(b) Closest cylinder next.
(c) Elevator algorithm (initially moving upward).
(d) 改进的电梯算法
In all cases, the arm is initially at cylinder 20.


(a)FCFS:按照给的顺序把距离求出来相加然后乘寻道时间即可
	sum = (20-10)+(22-10)+(22-20)+(20-2)+(40-2)+(40-6)+(38-6) = 146ms
	6 * sum = 876 ms
(b)SSF:由于从20开始,每次找离当前位置最近的,求和乘寻道时间
	6 * (2+12+4+4+36+2)=360ms
	顺序:20 22 10 6 2 38 40
(c)elevator(中文书P214):从开始位置先向上遍历完所有上面的请求再往下跑
	6*(2+16+2+30+4+4)=348ms
	顺序:20 22 38 40 10 6 2
(d)改进:从开始位置先向上遍历完所有上面的请求  再去最低的没有完成的请求处往上遍历
	6*(2+16+2+38+4+4)=396MS
	顺序:20 22 38 40 2 6 10
上一篇:limiting connections by zone "perip" 503错误怎么解决


下一篇:ios兼容