Module13: Secondary- Storage二级存储 ● Disk Structure 磁盘结构 ° Disk Scheduling 磁盘调度 ° Disk Management 磁盘管理 Swap-Space Management交换空间管理 · Disk Reliability 磁盘可靠性 ° Stable-Storage Implementation稳定存储实现 Tertiary Storage Devices 三级存储设备 Operating System Issues 有关操作系统的问题 ● Performance ssues 有关性能的问题 Applied Operating System Concepts 13.1 Silberschatz, Galvin, and Gagne @1999
13.1 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Module 13: Secondary-Storage 二级存储 • Disk Structure 磁盘结构 • Disk Scheduling 磁盘调度 • Disk Management 磁盘管理 • Swap-Space Management 交换空间管理 • Disk Reliability 磁盘可靠性 • Stable-Storage Implementation 稳定存储实现 • Tertiary Storage Devices 三级存储设备 • Operating System Issues 有关操作系统的问题 • Performance Issues 有关性能的问题
Disk Structure磁盘结构 Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer.磁盘设备是以一种逻辑块的一维大数组的形式编址 的,这里的逻辑块是传输的最小单位。 The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially.逻辑块的一维数组映射到磁 盘上一些相连的扇区 Sector 0 is the first sector of the first track on the outermost cylinder.0扇区是最外边柱面的第一个磁道的 第一个扇区。 Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost. 3ta 首先都映射到一个磁道,其余的数据映射到同一柱面的其 他磁道,然后按照从外向里的顺序映射到其余的柱面。 Applied Operating System Concepts 13.2 Silberschatz, Galvin, and Gagne @1999
13.2 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Disk Structure 磁盘结构 • Disk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. 磁盘设备是以一种逻辑块的一维大数组的形式编址 的,这里的逻辑块是传输的最小单位。 • The 1-dimensional array of logical blocks is mapped into the sectors of the disk sequentially. 逻辑块的一维数组映射到磁 盘上一些相连的扇区。 – Sector 0 is the first sector of the first track on the outermost cylinder. 0扇区是最外边柱面的第一个磁道的 第一个扇区。 – Mapping proceeds in order through that track, then the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost. 数据 首先都映射到一个磁道,其余的数据映射到同一柱面的其 他磁道,然后按照从外向里的顺序映射到其余的柱面
Disk Scheduling磁盘调度 The operating system is responsible for using hardware efficiently for the disk drives, this means hav ing a fast access time and disk bandwidth.操作系统有责任高效地使用硬件——对 于磁盘设备,这意味着很短的访问时间和磁盘带宽。 Access time has two major components访问时间包括两个主要 部分 Seek time is the time for the disk are to move the heads to the cylinder containing the desired sector..寻道时间是指把 磁头移到所需柱面的时间 Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head.旋转延迟是指 等待磁盘上所需要的扇区旋转到磁头下面的时间。 Minimize seek time最小寻道时间 Seek time≈ seek distance寻道时间≈寻道距离 Disk bandwidth is the total number of bytes transferred, div ided by the total time between the first request for serv ice and the completion of the last transfer.磁盘带宽,是用传输的总位数,除 以第一个服务请求与最后传输完成之间的总时间。 Applied Operating System Concepts 13.3 Silberschatz, Galvin, and Gagne @1999
13.3 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Disk Scheduling 磁盘调度 • The operating system is responsible for using hardware efficiently — for the disk drives, this means having a fast access time and disk bandwidth. 操作系统有责任高效地使用硬件——对 于磁盘设备,这意味着很短的访问时间和磁盘带宽。 • Access time has two major components 访问时间包括两个主要 部分 – Seek time is the time for the disk are to move the heads to the cylinder containing the desired sector. 寻道时间是指把 磁头移到所需柱面的时间。 – Rotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head. 旋转延迟是指 等待磁盘上所需要的扇区旋转到磁头下面的时间。 • Minimize seek time 最小寻道时间 • Seek time seek distance 寻道时间 寻道距离 • Disk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion of the last transfer. 磁盘带宽,是用传输的总位数,除 以第一个服务请求与最后传输完成之间的总时间
Disk Scheduling(cont)磁盘调度(续 Several algorithms exist to schedule the servicing of disk I/O requests.有几种磁盘Wo请求的服务调度算法 We illustrate them with a request queue(0-199),.我们假设 个请求序列。 98,183,37,122,14,124,65,67 Head pointer53磁头当前的位置在53 Applied Operating System Concepts 13.4 Silberschatz, Galvin, and Gagne @1999
13.4 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts Disk Scheduling (Cont.) 磁盘调度(续 ) • Several algorithms exist to schedule the servicing of disk I/O requests. 有几种磁盘I/O请求的服务调度算法 • We illustrate them with a request queue (0-199). 我们假设一 个请求序列。 98, 183, 37, 122, 14, 124, 65, 67 Head pointer 53 磁头当前的位置在53
FcFS先来先服务 llustration shows total head movement of640 cylinders.如下图所示,磁头总 共移动了640个柱面的距离。 queue=98,183,37,122,14,124,65,67 head starts at 53 014 37536567 98122124 183199 Applied Operating System Concepts 13.5 Silberschatz, Galvin, and Gagne @1999
13.5 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts FCFS 先来先服务 Illustration shows total head movement of 640 cylinders. 如下图所示,磁头总 共移动了640个柱面的距离
SSTF最短寻道时间优先 Selects the request with the minimum seek time from the current head position.选择从当前磁头位置所需寻道时间最 短的请求。 SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests.SSTF是SJF调度的一种形式; 有可能引起某些请求的饥饿。 Illustration shows total head movement of 236 cylinders. sn 图所示,磁头移动的总距离是236柱面 Applied Operating System Concepts 13.6 Silberschatz, Galvin, and Gagne @1999
13.6 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts SSTF 最短寻道时间优先 • Selects the request with the minimum seek time from the current head position. 选择从当前磁头位置所需寻道时间最 短的请求。 • SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests. SSTF是SJF调度的一种形式; 有可能引起某些请求的饥饿。 • Illustration shows total head movement of 236 cylinders. 如 图所示,磁头移动的总距离是236柱面
SSTF(Cont) queue=98,183,37,122,14,124,65,67 head starts at 53 014 37536567 98122124 183199 Applied Operating System Concepts 13.7 Silberschatz, Galvin, and Gagne @1999
13.7 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts SSTF (Cont.)
scAN扫描算法 The disk arm starts at one end of the disk and moves toward the other end, servicing requests until it gets to the other end of the disk. where the head movement is reversed and servicing continues.磁头从磁盘的一端开始向另一端移动, 沿途响应访问请求,直到到达了磁盘的另一端,此时磁头反向 移动并继续响应服务请求。 Sometimes called the elevator algorithm.有时也称为电梯算 法。 Illustration shows total head movement of 208 cylinders. A 图所示,磁头移动的总距离是208柱面。 Applied Operating System Concepts 138 Silberschatz, Galvin, and Gagne @1999
13.8 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts SCAN 扫描算法 • The disk arm starts at one end of the disk, and moves toward the other end, servicing requests until it gets to the other end of the disk, where the head movement is reversed and servicing continues. 磁头从磁盘的一端开始向另一端移动, 沿途响应访问请求,直到到达了磁盘的另一端,此时磁头反向 移动并继续响应服务请求。 • Sometimes called the elevator algorithm. 有时也称为电梯算 法。 • Illustration shows total head movement of 208 cylinders. 如 图所示,磁头移动的总距离是208柱面
SCAN (Cont 0J寸 3、e3e29 8 SSIS寸 」83J0 pesq asifa sf 23 dnen6=88:」833J5S'J」Sep'e⊥ Applied Operating System Concepts 13.9 Silberschatz, Galvin, and Gagne @1999
13.9 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts SCAN (Cont.)
C-SCAN Provides a more uniform wait time than SCaN.提供比扫描 算法更均衡的等待时间。 The head moves from one end of the disk to the other servicing requests as it goes. When it reaches the other end however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip.磁头从磁盘 的一段向另一端移动,沿途响应请求。当它到了另一端,就立 即回到磁盘的开始处,在返回的途中不响应任何请求。 Treats the cylinders as a circular list that wraps around from the last cylinder to the first o e.把所有柱面看成一个循环的 序列,最后一个柱面接续第一个柱面。 Applied Operating System Concepts 13.10 Silberschatz, Galvin, and Gagne @1999
13.10 Silberschatz, Galvin, and Gagne ©1999 Applied Operating System Concepts C-SCAN • Provides a more uniform wait time than SCAN. 提供比扫描 算法更均衡的等待时间。 • The head moves from one end of the disk to the other. servicing requests as it goes. When it reaches the other end, however, it immediately returns to the beginning of the disk, without servicing any requests on the return trip. 磁头从磁盘 的一段向另一端移动,沿途响应请求。当它到了另一端,就立 即回到磁盘的开始处,在返回的途中不响应任何请求。 • Treats the cylinders as a circular list that wraps around from the last cylinder to the first one. 把所有柱面看成一个循环的 序列,最后一个柱面接续第一个柱面