操作系统第七版第十二章_第1页
操作系统第七版第十二章_第2页
操作系统第七版第十二章_第3页
操作系统第七版第十二章_第4页
操作系统第七版第十二章_第5页
已阅读5页,还剩79页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、 12.2 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nOverview of Mass Storage Structure nDisk Structure nDisk Attachment nDisk Scheduling nDisk Management nSwap-Space Management nRAID Structure nDisk Attachment nStable-Storage Implementation nTertiary Storage

2、 Devices nOperating System Issues nPerformance Issues 12.3 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nDescribe the physical structure of secondary and tertiary storage devices and the resulting effects on the uses of the devices nExplain the performance c

3、haracteristics of mass- storage devices nDiscuss operating-system services provided for mass storage, including RAID and HSM 12.4 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nMagnetic disks provide bulk of secondary storage of modern computers lDrives rotat

4、e at 60 to 10,000 times per second lTransfer rate is rate at which data flow between drive and computer lPositioning time (random-access time) is time to move disk arm to desired cylinder (seek time) and time for desired sector to rotate under the disk head (rotational latency) lHead crash results f

5、rom disk head making contact with the disk surface 4Thats bad nDisks can be removable nDrive attached to computer via I/O bus lBusses vary, including EIDE, ATA, SATA, USB, Fibre Channel, SCSI lHost controller in computer uses bus to talk to disk controller built into drive or storage array 12.5 Silb

6、erschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.6 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nMagnetic tape (Chapter 12.1.2) lWas early secondary-storage medium lRelatively permanent and holds large quantities of data

7、lAccess time slow lRandom access 1000 times slower than disk lMainly used for backup, storage of infrequently-used data, transfer medium between systems lKept in spool and wound or rewound past read-write head lOnce data under head, transfer rates comparable to disk l20-200GB typical storage lCommon

8、 technologies are 4mm, 8mm, 19mm, LTO-2 and SDLT 12.7 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nDisk drives are addressed as large 1-dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. nThe 1-dimensional array

9、of logical blocks is mapped into the sectors of the disk sequentially. lSector 0 is the first sector of the first track on the outermost cylinder. lMapping 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

10、 innermost. 12.8 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nHost-attached storage accessed through I/O ports talking to I/O busses nSCSI itself is a bus, up to 16(15) devices on one cable, SCSI initiator requests operation and SCSI targets perform tasks l

11、Each target can have up to 8 logical units (disks attached to device controller) nFC is high-speed serial architecture lFiber Channel Arbitrated Loop-光纤通道仲裁环路可支持多达126个设备,SCSI只能 在每个总线上支持15个设备。每个主适配器板带有二个FC-AL插口,很容易建立万亿字节的大容 量存储; l光纤通道有一个较高的性能基线,即其每个环路的最大传输速率为100Mbytes/sec, 它结合通道技术和网络技术从物理层到应用层的一系列协议提

12、供更高的带宽,更长 的连接距离和更灵活的连接方式; lCan be switched fabric with 24-bit address space the basis of storage area networks (SANs) in which many hosts attach to many storage units lCan be arbitrated loop (FC-AL) of 126 devices 12.9 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1,

13、 2005 nNetwork-attached storage (NAS) is storage made available over a network rather than over a local connection (such as a bus) nNFS and CIFS are common protocols nImplemented via remote procedure calls (RPCs) between host and storage nNew iSCSI protocol uses IP network to carry the SCSI protocol

14、 12.10 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nCommon in large storage environments (and becoming more common) nMultiple hosts attached to multiple storage arrays - flexible 12.11 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Editio

15、n, Jan 1, 2005 nThe operating system is responsible for using hardware efficiently for the disk drives, this means having a fast access time and disk bandwidth. nAccess time has two major components lSeek time is the time for the disk are to move the heads to the cylinder containing the desired sect

16、or. lRotational latency is the additional time waiting for the disk to rotate the desired sector to the disk head. nMinimize seek time nSeek time seek distance nDisk bandwidth is the total number of bytes transferred, divided by the total time between the first request for service and the completion

17、 of the last transfer. 12.12 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nSeveral algorithms exist to schedule the servicing of disk I/O requests. nWe illustrate them with a request queue (0-199). 98, 183, 37, 122, 14, 124, 65, 67 Head pointer 53 12.13 Silb

18、erschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 FCFS磁盘调度算法根据进程请求访问磁盘的的先后次序进行调度。磁盘调度算法根据进程请求访问磁盘的的先后次序进行调度。 Illustration shows total head movement of 640 cylinders. 12.14 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nSimple,

19、 intrinsically fair, but generally does not provide the fastest service. n平均寻道距离大平均寻道距离大 l磁臂来回摆动;磁臂来回摆动; l效率低;效率低; lIllustration shows total head movement of 640 cylinders. l(183-53)+(183-37)+(122-37)+(122-14)+(124-14)+(124- 65)+(67-65)=640 12.15 Silberschatz, Galvin and Gagne 2005 Operating System

20、Concepts 7th Edition, Jan 1, 2005 nSelects the request with the minimum seek time from the current head position. nSSTF scheduling is a form of SJF scheduling; may cause starvation of some requests. nRequest queue: 98, 183, 37, 122, 14, 124, 65, 67 n调度顺序:调度顺序: 53,65,67,37,14,98,122,124,183 nIllustra

21、tion shows total head movement of 236 cylinders. l(67-53)+(67-14)+(183-14)=236 n贪心算法贪心算法 12.16 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.17 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nSSTF较之FCFS有更好的寻道性能,故过去一度

22、 被广泛采用过 n可能导致进程发生“饥饿”现象; n磁臂粘着 n不能保证平均寻道时间最短不能保证平均寻道时间最短 (not optimal) nRequest queue: 98, 183, 37, 122, 14, 124, 65, 67 nSSTF调度顺序:调度顺序: 53,65,67,37,14,98,122,124,183 n如果调度顺序为:53,37,14,65,67,98,122,124,183 则 total head movement is 208 cylinders. (53-14)+(183-14)=208 nSSTF is common and has a natural

23、 appeal 12.18 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nThe 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

24、. nSometimes called the elevator algorithm. nHeads current position:53 nThe direction of head movement: the disk arm is moving toward 0 nRequest queue: 98, 183, 37, 122, 14, 124, 65, 67 12.19 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.20 Silberschatz, G

25、alvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nHeads current position: 53 nThe direction of head movement: the disk arm is moving toward 0 nRequest queue: 98, 183, 37, 122, 14, 124, 65, 67 n调度顺序是: 53,37,14,0,65,67,98,122,124,183 nIllustration shows total head movement of 23

26、6 cylinders. l(53-0)+(183-0)=236 12.21 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n两个要点:两个要点: lHeads current position (当前位置当前位置) lThe direction of head movement (当前方向当前方向) n与与SSTF相比,避免进程出现相比,避免进程出现“饥饿饥饿”现象;现象; nSCAN perform better for systems that place a

27、heavy load on the disk. n若磁盘服务请求均匀地分布在各个柱面上,当磁头到达一端折若磁盘服务请求均匀地分布在各个柱面上,当磁头到达一端折 返往回移动时,在该端等待服务的请求可能很少,等待的时间返往回移动时,在该端等待服务的请求可能很少,等待的时间 也比较短,因为该区域的请求刚刚被访问过;也比较短,因为该区域的请求刚刚被访问过; n而另一端等待服务的请求可能很多,等待的时间也可能很长;而另一端等待服务的请求可能很多,等待的时间也可能很长; n另一端的请求应该优先得到服务;另一端的请求应该优先得到服务; 12.22 Silberschatz, Galvin and Gagne

28、 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nProvides a more uniform wait time than SCAN. nThe 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

29、any requests on the return trip. nTreats the cylinders as a circular list that wraps around from the last cylinder to the first one. nCSCAN规定磁头单向移动。系统沿着一个方向(例如由规定磁头单向移动。系统沿着一个方向(例如由 内向外),依次对请求进行服务,到达最外端后,磁头立即内向外),依次对请求进行服务,到达最外端后,磁头立即 返回到最内端,然后再由里向外依次对请求进行服务。返回到最内端,然后再由里向外依次对请求进行服务。 12.23 Silberscha

30、tz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.24 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n与与SCAN相比,公平相比,公平 nC-SCAN perform better for systems that place a heavy load on the disk. n假定磁盘的最外道号为199,最内道号为0 nHeads current pos

31、ition: 53 nThe direction of head movement: the disk arm is moving toward 199 nRequest queue: 98, 183, 37, 122, 14, 124, 65, 67 n调度顺序:53,65,67,98,122,124,183,199,0,14,37 nIllustration shows total head movement of 382 cylinders. l(199-53)+(199-0)+(37-0)=382 12.25 Silberschatz, Galvin and Gagne 2005 Op

32、erating System Concepts 7th Edition, Jan 1, 2005 nVersion of SCAN or C-SCAN nArm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk. nSCAN Look nC-SCAN C-Look 12.26 Silberschatz, Galvin and Gagne 2005 Op

33、erating System Concepts 7th Edition, Jan 1, 2005 12.27 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n与SCAN 相比,提高了效率; nHeads current position: 53 nThe direction of head movement: the disk arm is moving toward 0 nRequest queue: 98, 183, 37, 122, 14, 124, 65, 6

34、7 n调度顺序是:53,37,14,65,67,98,122,124,183 nTotal head movement of 208 cylinders. l(53-14)+(183-14)=208 12.28 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nVersion of C-SCAN nArm only goes as far as the last request in each direction, then reverses direction imm

35、ediately, without first going all the way to the end of the disk. n假定磁盘的最外道号为 199,最内道号为 0 nHeads current position: 53 nThe direction of head movement: the disk arm is moving toward 199 12.29 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.30 Silberschatz, Ga

36、lvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nVersion of C-SCAN nArm only goes as far as the last request in each direction, then reverses direction immediately, without first going all the way to the end of the disk. nC-SCAN相比,提高了效率; n假定磁盘的最外道号为 199,最内道号为 0 nHeads current

37、position: 53 nThe direction of head movement: the disk arm is moving toward 199 nRequest queue: 98, 183, 37, 122, 14, 124, 65, 67 n调度顺序是调度顺序是:53,65,67,98,122,124,183,14,37 nIllustration shows total head movement of 322 cylinders. l(183-53)+(183-14)+(37-14)=322 12.31 Silberschatz, Galvin and Gagne 20

38、05 Operating System Concepts 7th Edition, Jan 1, 2005 nSSTF is common and has a natural appeal nSCAN and C-SCAN perform better for systems that place a heavy load on the disk. nPerformance depends on the number and types of requests. nRequests for disk service can be influenced by the file- allocati

39、on method. l连续文件性能最好;链接及索引文件可能需要再次寻道移动连续文件性能最好;链接及索引文件可能需要再次寻道移动 nThe disk-scheduling algorithm should be written as a separate module of the operating system, allowing it to be replaced with a different algorithm if necessary. nEither SSTF or LOOK is a reasonable choice for the default algorithm. 1

40、2.32 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nSuppose that a disk drive has 5000 cylinders, numbered 0 to 4999. The drive is currently serving a request at cylinder 143, and the previous request was at cylinder 125. The queue of pending requests, in FIF

41、O order, is: 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130 . 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? na. FCFS nb. SSTF nc. SCAN nd. LOOK ne.

42、 C-SCAN nf. C-LOOK 12.33 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 na. The FCFS schedule is 143, 86, 1470, 913, 1774, 948, 1509, 1022, 1750, 130. The total seek distance is 7081. nb. The SSTF schedule is 143, 130, 86, 913, 948, 1022, 1470, 1509, 1750, 177

43、4. The total seek distance is 1745. nThe SCAN schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 4999, 130, 86. The total seek distance is 9769. nd. The LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 130, 86. The total seek distance is 3319. ne. The C-SCAN schedule is 143, 913,

44、948, 1022, 1470, 1509, 1750, 1774, 4999, 0, 86, 130. The total seek distance is 9985. nf. The C-LOOK schedule is 143, 913, 948, 1022, 1470, 1509, 1750, 1774, 86, 130. The total seek distance is 3363. 12.34 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nLow-le

45、vel formatting, or physical formatting Dividing a disk into sectors that the disk controller can read and write. nTo use a disk to hold files, the operating system still needs to record its own data structures on the disk. lPartition the disk into one or more groups of cylinders. lLogical formatting

46、 or “making a file system”. nBoot block initializes system. lThe bootstrap is stored in ROM. lBootstrap loader program. nMethods such as sector sparing used to handle bad blocks. 12.35 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.36 Silberschatz, Galvin a

47、nd Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 MBR- Master Boot Record 12.37 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nSwap-space Virtual memory uses disk space as an extension of main memory. nSwap-space can be carved out of the normal

48、 file system, or, more commonly, it can be in a nSwap-space management l4.3BSD allocates swap space when process starts; holds text segment (the program) and data segment. lKernel uses swap maps to track swap-space use. lSolaris 2 allocates swap space only when a page is forced out of physical memor

49、y, not when the virtual memory page is first created. 12.38 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 In swap map, the value of the counter is 0indeicates the corresponding page slot is available 1indeicates the swapped page is mapped to a process 3indeic

50、ates the swapped page is mapped to three different processes (the swapped page is storing a region of memory shared by three processes) 12.39 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n磁盘容错技术,也称为系统容错技术磁盘容错技术,也称为系统容错技术 SFT-I 低级磁盘容错技术低级磁盘容错技术 防止磁盘表面发生缺陷所引起的

51、数据丢失;防止磁盘表面发生缺陷所引起的数据丢失; SFT-II 中级磁盘容错技术中级磁盘容错技术 (RAID) 防止磁盘驱动器和磁盘控制器故障所引起的系统不能正常工作防止磁盘驱动器和磁盘控制器故障所引起的系统不能正常工作 ; SFT-III 高级磁盘容错技术高级磁盘容错技术 机器或系统出现故障;机器或系统出现故障; 12.40 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n防止磁盘表面发生缺陷所引起的数据丢失;防止磁盘表面发生缺陷所引起的数据丢失; n双备份目录和双

52、备份文件分配表双备份目录和双备份文件分配表 n热修复重定向和写后读校验热修复重定向和写后读校验 热修复重定向热修复重定向 磁盘格式化时系统一般都预留一部分扇区,用于存放当写入数据发现磁盘格式化时系统一般都预留一部分扇区,用于存放当写入数据发现 坏扇区时,用于替换坏扇区;(不属于任何分区)坏扇区时,用于替换坏扇区;(不属于任何分区) 写后读校验写后读校验 写入数据后立即读出进行比较,判断是否因磁盘表面损坏而导致的写入写入数据后立即读出进行比较,判断是否因磁盘表面损坏而导致的写入 错误;错误; 12.41 Silberschatz, Galvin and Gagne 2005 Operating

53、System Concepts 7th Edition, Jan 1, 2005 n防止磁盘驱动器和磁盘控制器故障所引起的系统不防止磁盘驱动器和磁盘控制器故障所引起的系统不 能正常工作能正常工作 nRAID技术技术-Redundant arrays of inexpensive disks (廉价磁盘冗余阵列廉价磁盘冗余阵列) nRAID- Redundant arrays of independent disks (独立磁盘冗余阵列独立磁盘冗余阵列) 12.42 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th

54、 Edition, Jan 1, 2005 n防止机器或系统出现故障,造成数据丢失防止机器或系统出现故障,造成数据丢失 n系统热备份(机器热备份)系统热备份(机器热备份) 12.43 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nRAID技术技术-Redundant Arrays of Inexpensive Disks n廉价磁盘冗余阵列 nRAID技术技术-Redundant Array of Independent Disks n独立磁盘冗余阵列 nRAID

55、multiple disk drives provides reliability and performance via redundancy. nRAID is arranged into six different levels. 12.44 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nSeveral improvements in disk-use techniques involve the use of multiple disks working c

56、ooperatively. nDisk striping uses a group of disks as one storage unit. l卷集卷集(多磁盘分区顺序存取)与(多磁盘分区顺序存取)与带区集带区集(交叉存取)(交叉存取) nRAID schemes improve performance and improve the reliability of the storage system by storing redundant data. lMirroring or shadowing keeps duplicate of each disk. lBlock interlea

57、ved parity uses much less redundancy. 12.45 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 RAID:并行交叉存取,及数据冗余与校验:并行交叉存取,及数据冗余与校验 123 N 12.46 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n目的与手段目的与手段 改善系统的可靠性数据冗余及改善系统的可靠性

58、数据冗余及 校验校验+容错技术容错技术 提高系统的性能并行交叉存取(位级或块级分散)提高系统的性能并行交叉存取(位级或块级分散) n类比:存储器的多体交叉存取技术类比:存储器的多体交叉存取技术 一个存储器分成多个存储体(例如一个存储器分成多个存储体(例如4个),将一个程序的指令与数据按顺个),将一个程序的指令与数据按顺 序依次存储在四个体中;序依次存储在四个体中;4个体可以同时进行存取操作,提高了存储器个体可以同时进行存取操作,提高了存储器 的存取速度;的存取速度; n可以将该技术应用于磁盘的数据存取操作;可以将该技术应用于磁盘的数据存取操作; 12.47 Silberschatz, Galv

59、in and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 n将数据按将数据按位级位级或者按或者按块级块级分散写入到多个磁盘上,多个磁盘可以分散写入到多个磁盘上,多个磁盘可以 同时同时读写存取操作,实现数据的读写存取操作,实现数据的并行存取并行存取提高了系统的性能;提高了系统的性能; n如果再结合如果再结合数据冗余技术数据冗余技术及及校验技术校验技术,例如磁盘镜像、其它校验,例如磁盘镜像、其它校验 技术(技术(CRC、Hamming等),还可以提高系统的可靠性;等),还可以提高系统的可靠性; 12.48 Silber

60、schatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 12.49 Silberschatz, Galvin and Gagne 2005 Operating System Concepts 7th Edition, Jan 1, 2005 nRAID的分级的分级 l(a) RAID 0:无冗余的磁盘阵列:无冗余的磁盘阵列 4数据数据块级块级分散,并行交叉存取,无数据冗余;分散,并行交叉存取,无数据冗余; 4一个磁盘出错,整个磁盘系统就无法使用一个磁盘出错,整个磁盘系统就无法使用 l(b)

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论