Download presentation
Presentation is loading. Please wait.
Published byAvice Roberts Modified over 9 years ago
1
Mass storage Structure Unit 5 (Chapter 14)
2
Disk Structures Magnetic disks are faster than tapes. Disk drives are addressed as large one- dimensional arrays of logical blocks, where the logical block is the smallest unit of transfer. The size of a logical block is usually 512 bytes, or 1,024 bytes. The one-dimensional array of logical blocks is mapped onto the sectors of the disk sequentially.
3
Disk structure
4
Sector 0 is the first sector of the first track on the outermost cylinder. The mapping proceeds in order through that track, then through the rest of the tracks in that cylinder, and then through the rest of the cylinders from outermost to innermost. By using this mapping, we can convert a logical block number in to a disk address – that consists of a cylinder number, a track number within that cylinder, and a sector number within that track. In practice, it is difficult to perform this translation, for two reasons. – First, most disks have some defective sectors, but the mapping hides this by substituting spare sectors from elsewhere on the disk – Second, the number of sectors per track is not a constant on some drives.
5
Number of sectors per track is not a constant on some drives – WHY? Constant linear velocity (CLV) - the density of bits per track is uniform. – The farther a track is from the center of the disk, the greater its length, so the more sectors it can hold. As we move from outer zones to inner zones, the number of sectors per track decreases. Solution: The drive increases its rotation speed as the head moves from the outer to the inner tracks to keep the same rate of data moving under the head (CD-ROM, DVD-ROM drives).
6
Alternatively, the disk rotation speed can stay constant, and the density of bits decreases from inner tracks to outer tracks to keep the data rate constant. This method is used in hard disks and is known as constant angular velocity (CAV)
7
Goals: Faster access time and large disk bandwidth The access time has two major components. – The seek time is the time for the disk arm to move the heads to the cylinder containing the desired sector. – The rotational latency is the additional time for the disk to rotate the desired sector to the disk head. The 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 We can improve both the access time and the bandwidth by scheduling the servicing of disk I/O requests in a good order. For a multiprogramming system with many processes, the disk queue may often have several pending requests Thus, when one request is completed, the OS chooses which pending Request to service next. How does the OS make this choice? Solution: Disk-scheduling algorithms.
8
Disk Scheduling Several algorithms exist to schedule the servicing of disk I/O requests. We illustrate them with a request queue (0- 199) for the blocks on cylinders 98, 183, 37, 122, 14, 124, 65, 67 Head pointer 53
9
Disk Scheduling Algorithms – FCFS – SSTF – SCAN – CSCAN – LOOK – CLOOK
10
Disk Scheduling: FCFS 98, 183, 37, 122, 14, 124, 65, 67
11
FCFS: total head movement of 640 cylinders.
12
FCFS Intrinsically fair But does not provide the fastest service
13
SSTF (Shortest Seek Time First) 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. Not optimal.
14
Disk Scheduling: SSTF 98, 183, 37, 122, 14, 124, 65, 67
15
SSTF example
16
SSTF: total head movement of 236 cylinders
17
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.
18
SCAN
19
SCAN: total head movement of 208 cylinders
20
SCAN Assume a uniform density of requests. When a head reverses direction, there are relatively less requests, as these cylinders have been recently serviced. C-SCAN
21
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.
22
C-SCAN
23
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. Looks for a request before continuing to move in a given direction LOOK
24
C-LOOK
25
Selecting a Disk-Scheduling Algorithm SSTF is common and has a natural appeal a heavy load on the disk SCAN and C-SCAN. 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, allowing it to be replaced if necessary. Either SSTF or LOOK is a reasonable choice for the default algorithm.
26
Disk Management Low-level formatting, or physical formatting — Dividing a disk into sectors that the disk controller can read and write. To use a disk to hold files, the operating system still needs to record its own data structures on the disk. – Partition the disk into one or more groups of cylinders. – Logical formatting or “making a file system”.
27
Swap Space Virtual memory – Will use regular file system for at least reading code and data of program – Partition formatted for swap space can give higher virtual memory performance – Swap space on separate device or multiple devices Swap space manager allocates/deallocates blocks – Doesn’t use functions of normal file system – Maintain map(s) of swap space usage May handle text (code) & data differently – E.g., Solaris 1 – don’t swap text to swap disk; if page replacement needs page, next time just re-read from normal file system; dirty data pages still written to swap disk as needed
28
RAID Structure RAID: Redundant Arrays of Independent Disks RAID: Multiple disk drives provides reliability via redundancy. Redundancy: – Mirroring (Shadowing): duplicate every disk, a logical disk consists of two physical disks, each write is done on both disks – Number of reads are doubled as both disks are operative To improve transfer rate: – Data striping: – bit-striping: split the bits of each byte across multiple disks byte, sector, block level striping The number of disks is either a multiple of 8 or divides 8.
29
RAID Structure To improve transfer rate: Data striping: split the bits of each byte across multiple disks byte, sector, block level striping Bit-level striping: If 8 disks are there, bit i of a byte goes to disk i. Block-level striping: With n disks, block i of a file, goes to disk (i mod n+1).
30
RAID Structure Potential drawbacks – Larger number of disks decreases mean-time-to- failure (MTTF) More disks provide more points of failure Data stored in many RAID levels can be lost if more than one drive in array fails
31
RAID Levels Mirroring is expensive Striping high data transfer rate, but improved reliability Different schemes, disk striping + parity bits, gives different RAID levels P – error correcting bits, C – copy of data Six different RAID levels
32
RAID Levels
33
Level 0 – Simplest RAID implementation – Includes striping but no redundancy (not a “true” RAID level) – Highest-performing RAID level for a fixed number of disks – High risk of data loss Multiple drives involved Could lose all data in array with one drive failure – Appropriate where performance greatly outweighs reliability
34
RAID Levels: 0 Logical DISK 0 1 2 3 4 5 6 7 8 9 10 11
35
RAID Levels: 0
36
RAID Levels Level 0 – Block level striping Notes: – If two different I/O requests are pending for two different blocks of data, in all likelihood the two blocks are located in two different disks, then the requests can be issued in parallel – If a single request is spread across multiple logically contiguous strips, the request can be handled in parallel
37
RAID Level 1 – Highest level of redundancy/fault tolerance for traditional RAID levels – Each drive has a mirrored copy in array – No striping at this level Improves read performance over single disks because multiple disks can be read at once Slower write performance because two disks must be accessed for each modified data item to maintain mirroring – High storage overhead Only half array stores unique data – Most suitable where reliability is primary concern
38
RAID Levels: 1
41
RAID Levels Level 1 – Read request serviced by the disk which has minimum seek time – Write speed = both disks to be updated, dictated by the slower of the two disks – No “write penalty” involved – Suitable if bulk of the I/O requests are read – Limit RAID 1 to system software, and critical data (real-time data)
42
RAID Levels Level 2 – Implements redundancy and striping Striped at bit level Uses Hamming ECC to check data integrity – Parity bits store the evenness or oddness of a sum of bits – ECC data stored on separate drive – Significant overhead in storage (though less than level 1 arrays) and performance (due to calculating ECC data) – Not the most appropriate error checking method; ECC is performed internally by most hard disks Rarely seen in modern systems
43
RAID Levels 2
46
RAID Levels Level 2 – Read – all disks are simultaneously accessed – Write - all disks are simultaneously accessed Write penalty – computation of the Hamming ECC – Used when many disk errors occur, but given the high reliability of individual disks, rarely used.
47
RAID Levels Level 3 – Also stripes at the bit level – Uses XOR to calculate parity for ECC Much simpler than Hamming ECC Requires only one disk for parity information regardless of the size of the array Cannot determine which bit contains error, but this information can be gathered easily by inspecting the array for a failed disk High transfer rates, but only one request serviced at a time
48
RAID Levels 3
50
RAID Levels Level 3 – In the case of a disk failure, All data are available missing data can be calculated from the parity bit Write: just maintain the parity such that later it can be regenerated. Failed disk to be replaced and the data regenerated
51
RAID Levels Level 4 – Similar to RAID level 3 Stores larger strips than other levels Can service more requests simultaneously as files are more likely to be on one disk Write requests must be performed one at a time – Restriction eliminated in level 5 Rarely implemented because level 5 is similar but superior
52
RAID Levels 4
54
RAID Levels Level 5 – Similar to level 4 Removes write bottleneck of RAID level 4, because parity blocks are distributed across disks Still must update parity information – For many small write operations, overhead can be substantial – Caching mechanisms can help alleviate this Faster and more reliable than levels 2–4 – Costlier and more complex as well – Among most commonly implemented RAID levels
55
RAID Levels 5
57
RAID Levels Level 5 – For each block one of the disks stores parity, others store data 5 disks, parity of the nth block is stored in (n mod 5) +1 disk. Potential overuse of the parity disk is avoided.
58
Level 6 – Two different parity calculations are carried out and stored in separate blocks on different disks – N disks N+2 Disks – Extreme high data availability, as three disks has to fail simultaneously – High write penalty as two parity blocks are to be updated.
59
RAID Levels
60
Other RAID levels exist – No standard naming convention – RAID level 0+1: set of striped disks that are copied to set of mirror disks – RAID level 1+0: set of mirrored data that is striped across a set of disks – Others include 0+3, 0+5, 50, 1+5, 51, 53 and RAID level 7
61
RAID Levels Selecting a RAID level: 0 – for high performance, data loss is not critical 1 – high reliability and fast recovery 0+1 and 1+0 – performance and reliability both important 5 – for storing large volumes of data Hot spare: a disk which readily replaces a failed disk. May be one of the mirrors.
62
Disk Management Boot block initializes system: – The bootstrap is stored in ROM. – Bootstrap program finds the OS kernel on disk – Bootstrap is stored on ROM – Problem of changing the bootstrap. – Tiny bootstrap loader which in turn loads the full bootstrap program – Partition containing the bootstrap program is called boot disk
63
Disk Management Bad block: One or more sectors are defective, these are called bad blocks. MS-DOS format: – do a logical format – Mark the bad blocks as unusable Sector sparing: – Low level formatting keeps spare sectors – Each bad sector is replaced with one such spare sector Sector Slipping: – Find the first available spare sector – Remap all sectors, moving down one spot. – Sector sparing:
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.