Lecture 27 Secondary Storage Structure Disk Fall 2000 M.B. Ibáñez 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. From Operating System Concepts. Silberschatz & Galvin. Addison Wesley Fall 2000 M.B. Ibáñez Disk Scheduling • 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. From Operating System Concepts. Silberschatz & Galvin. Addison Wesley Fall 2000 M.B. Ibáñez Disk Data Layout Sectors Tracks Inter-sector gap Inter-track gap Fall 2000 M.B. Ibáñez From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Disk Performance Parameters • To read or write, the disk head must be positioned at the desired track and at the beginning of the desired sector • Seek time – time it takes to position the head at the desired track • Rotational delay or rotational latency – time its takes until desired sector is rotated to line up with the head From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Fall 2000 M.B. Ibáñez Disk Performance Parameters • Access time – sum of seek time and rotational delay – the time it takes to get in position to read or write • Data transfer occurs as the sector moves under the head • Data transfer for an entire file is faster when the file is stored in the same cylinder and in adjacent sectors From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Fall 2000 M.B. Ibáñez Disk Scheduling Policies • First-come, first-served (FCFS) – process request sequentially – fair to all processes – approaches random scheduling in performance if there are many processes From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Fall 2000 M.B. Ibáñez FCFS Illustration shows total head movement of 640 cylinders. Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley 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. • Illustration shows total head movement of 236 cylinders. Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley SSTF (Cont.) Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley 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. From Operating System Concepts. Silberschatz & Galvin. Addison Wesley Fall 2000 M.B. Ibáñez SCAN (Cont.) Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley 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. Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley C-SCAN (Cont.) Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley C-LOOK • Version of C-SCAN • Arm 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. Fall 2000 M.B. Ibáñez From Operating System Concepts. Silberschatz & Galvin. Addison Wesley Selecting a Disk-Scheduling Algorithm • SSTF is common and has a natural appeal • SCAN and C-SCAN perform better for systems that place a heavy load on the disk. • Performance depends on the number and types of requests. • Requests for disk service can be influenced by the file-allocation method. • The 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. • Either SSTF or LOOK is a reasonable choice for the default algorithm. • From Operating System Concepts. Silberschatz & Galvin. Addison Wesley Fall 2000 M.B. Ibáñez RAID 0 (non-redundant) strip 0 strip 1 strip 2 strip 3 strip 4 strip 5 strip 6 strip 7 strip 8 strip 9 strip 10 strip 11 strip 12 strip 13 strip 14 strip 15 From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Fall 2000 M.B. Ibáñez RAID 1 (mirrored) Fall 2000 strip 0 strip 1 strip 2 strip 3 strip 4 strip 5 strip 6 strip 7 strip 8 strip 9 strip 10 strip 11 strip 12 strip 13 strip 14 strip 15 strip 0 strip 1 strip 2 strip 3 strip 4 strip 5 strip 6 strip 7 strip 8 strip 9 strip 10 strip 11 strip 12 strip 13 strip 14 strip 15 M.B. Ibáñez From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall RAID 2 (redundancy through Hamming code) b0 Fall 2000 b1 b2 b2 M.B. Ibáñez f0(b) f1(b) f2(b) From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall RAID 3 (bit-interleaved parity) b0 b1 b2 b2 P(b) From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Fall 2000 M.B. Ibáñez RAID 4 (block-level parity) block 0 block 1 block 2 block 3 P(0-3) block 4 block 5 block 6 block 7 P(4-7) block 8 block 9 block 10 block 11 block 12 block 13 block 14 block 15 P(8-11) P(12-15) Fall 2000 M.B. Ibáñez From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall RAID 5 (block-level distributed parity) block 0 block 1 block 2 block 3 P(0-3) block 4 block 5 block 6 P(4-7) block 7 block 8 block 12 block 9 P(8-11) block 10 block 11 P(12-15) block 13 block 14 block 15 block 16 block 17 block 18 block 19 P(16-19) From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall Fall 2000 M.B. Ibáñez Data Mapping for RAID Level 0 Array Physical Disk 0 Physical Disk 1 Physical Disk 2 Physical Disk 3 strip 0 strip 1 strip 2 strip 3 strip 4 strip 5 strip 6 strip 7 strip 8 strip 9 strip 10 strip 11 strip 12 strip 13 strip 14 strip 15 strip 0 strip 1 strip 2 strip 3 strip 4 strip 5 strip 6 strip 7 strip 8 strip 9 strip 10 strip11 Array Management Software strip 12 strip 13 strip 14 strip 15 Fall 2000 From Operating Systems. Internals and Design Principles. W. Stallings. Prentice Hall M.B. Ibáñez