14 store

Upload: tushar-goyal

Post on 07-Apr-2018

219 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/6/2019 14 Store

    1/53

    1

    Mass Storage

    StructureChapter 14

  • 8/6/2019 14 Store

    2/53

    2

    Chapter 14: Mass-Storage Systems14.1 Disk Structure14. 2 Disk Scheduling14.3 Disk Management

    14.4 Swap-Space Management14.5 RAID Structure14.6 Disk Attachment14.7 Stable-Storage Implementation14.8 Tertiary Storage Devices14.9 Operating System Issues14.10 Performance Issues

  • 8/6/2019 14 Store

    3/53

    3

    Hard Disks

    Tanenbaum, Figure 5- 2 5, Page 316

  • 8/6/2019 14 Store

    4/53

    4

    Disk Structure Disk drives addressed as large 1-dimensional

    arrays of logical blocks .

    The 1-dimensional array of logical blocks ismapped into the sectors of the disk sequentially. Starts at Sector 0 on the outermost cylinder. 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.

    14.1, Page 491

  • 8/6/2019 14 Store

    5/53

    5

    Disk Scheduling OS seeks to optimize access time, consisting

    mainly of See k time the time for the disk are to move the heads

    to the cylinder containing the desired sector. R otational lat e ncy the additional time waiting for the

    disk to rotate the desired sector to the disk head.

    Disk bandwidth total number of bytes transferred, divided by the total

    time taken (between the first request and completion of last transfer).

    14. 2 , Page 49 2

  • 8/6/2019 14 Store

    6/53

    6

    Disk-Scheduling Algorithms

    FCFS least efficient, has no optimization First Come, First Served

    SSTF is fast, but does not optimized head movement Shortest Seek Time First SCAN orders requests on in & out head movement Elevator algorithm

    C-SCAN circular SCAN, reads requests in one direction Blocks as circular list, by sawtooth head motion

    LOOK like SCAN, but limit in & out head movement Move between max and min requested tracks

    C-LOOK like C-SCAN, but limit in & out head moves14. 2 , Pages 493 498

  • 8/6/2019 14 Store

    7/53

    7

    Disk Scheduling Several algorithms exist to schedule the servicing

    of disk I/O requests. We illustrate them with a request queue (0-199).

    98, 183, 37, 1 22 , 14, 1 2 4, 65, 67

    Head pointer 53

    14. 2 , Page 493

  • 8/6/2019 14 Store

    8/53

    8

    First Come First Served

    Illustration shows total head movement of 640 cylinders.14. 2 .1, Figure 14.1, Page 14.1

  • 8/6/2019 14 Store

    9/53

    9

    SSTF Selects the request with the minimum seek

    time from the current head position.

    SSTF scheduling is a form of SJFscheduling; may cause starvation of somerequests.

    Illustration shows total head movement of 2 36 cylinders.

    14. 2 .1, Page 494

  • 8/6/2019 14 Store

    10/53

    10

    SSTF

    14. 2 .2 , Figure 14. 2 , Page 494

  • 8/6/2019 14 Store

    11/53

    11

    SCAN The disk arm starts at one end of the disk,

    and moves toward the other end, servicingrequests until it gets to the other end of thedisk, where the head movement is reversedand servicing continues.

    Sometimes called the e l ev ator algorithm . Illustration shows total head movement of

    2 08 cylinders.

    14. 2 .3, Page 495

  • 8/6/2019 14 Store

    12/53

    12

    Elevator Algorithm

    14. 2 .3, Figure 14.3, page 495, but this is Tanenbaum Figure 5- 2 8, page 3 2 0

  • 8/6/2019 14 Store

    13/53

    13

    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 itreaches the other end, however, it immediatelyreturns to the beginning of the disk, withoutservicing any requests on the return trip.

    Treats the cylinders as a circular list that wrapsaround from the last cylinder to the first one.

    14. 2 .4, Page 496

  • 8/6/2019 14 Store

    14/53

    14

    C-SCAN

    14. 2 .4, Figure 14.4, Page 496

  • 8/6/2019 14 Store

    15/53

    15

    C-LOOK Version of C-SCAN Arm only goes as far as the last request in

    each direction, then reverses directionimmediately, without first going all the wayto the end of the disk.

    14. 2 .5, Page 496 497

  • 8/6/2019 14 Store

    16/53

    16

    C-LOOK

    14. 2 .5, Figure 14.5, Page 497

  • 8/6/2019 14 Store

    17/53

    17

    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 aseparate module of the operating system, allowing it to bereplaced with a different algorithm if necessary.

    Either SSTF or LOOK is a reasonable choice for thedefault algorithm.

    14. 2 .6, Page 497

  • 8/6/2019 14 Store

    18/53

    18

    Disk Formatting Physical Formatting

    Dividing a disk into sectors that the disk controller canread and write.

    Partitioning The coarsest logical unit of storage for a disk system. Normally, disk is partitioned into one or more groups

    of cylinders.

    Logical Formatting Making the file system within each partition

    14.3, Page 499

  • 8/6/2019 14 Store

    19/53

    19

    Physical Formatting Dividing a disk into sectors that the disk controller can

    read and write.

    Constant linear velocity Uniform bit density, variable disk speed with head movement More sectors on the outer tracks (e.g. CDs)

    Constant angular velocity Data more dense toward inner tracks, to keep equal sectors

    Preamble Data ECC

    Error CorrectionCodes

    Start code,cylinder, sector

    256, 512 or 1024 bytes

    Sector

    Tanenbaum, Figure 5- 2 4, Page 315

  • 8/6/2019 14 Store

    20/53

    2 0

    Disk Formatting Partitioning

    The coarsest logical unit of storage for a disk system. Logically, each partition is like a separate disk.

    P artition tabl e is written at the end of the mast e r boot r e cord

    Logical Formatting High level format of each partition Making the file system within each partition Add boot block, free space list, root directory, and

    empty file system

    14.3.1, Page 499

  • 8/6/2019 14 Store

    21/53

    2 1

    Typical File System Layout

    MBR

    Disk partition

    Boot block

    Partition table

    Super block Free spacemanagement inodes Root dir Files

    Admin info File system type Number of blocks

    Indexed filecontrol block

    Tanenbaum, Figure 6-11, Page 400

  • 8/6/2019 14 Store

    22/53

    22

    MS-DOS Disk Layout

    14.3. 2 , Figure 14.6, Page 501

  • 8/6/2019 14 Store

    23/53

    2 3

    Bad Block Handling Manual

    Run chkdisk to search for bad blocks, lock them away Entry in FAT marks the block as bad (e.g. MS-DOS)

    Sector Sparing Controller maintains a list of bad blocks Have spare empty sectors for block replacement

    Sector Slipping Remap sectors to make sequential e.g. if 17 gone, and is spared at 2 02 , then move sectors

    18 to 2 02 up by one until a spare is created at 18

    14.3.3, Pages 500 501

  • 8/6/2019 14 Store

    24/53

    2 4

    Swap-Space Management Swap-space

    Disk space as an extension of main memory.

    Set up as a file in the normal file system Slower to navigate disk-allocation data structures Separate disk partition (more usual) Uses separate swap space storage manager allocate and deallocate blocks

    Optimized for speed rather than storage efficiency

    Solaris 2 makes both types available

    14.4, Pages 50 2

  • 8/6/2019 14 Store

    25/53

    2 5

    Swap-Space Management in UNIX

    4.3 BSD Allocates swap space when process starts; Holds t ex t se gme nt (the program) and data s e gme nt.

    e.g. two users of an editor share text segment, have

    own data segments Kernel uses swap maps to track swap-space use for

    text and data segments separately.

    Solaris 1 Read text, throw it away if not needed in memory

    Solaris 2 Solaris 2 allocates swap space only when a page is

    forced out of physical memory, not when the virtual

    memory page is first created.14.4.3, 503

  • 8/6/2019 14 Store

    26/53

    2 6

    4.3 BSD Swap MapsTextSegment

    DataSegment

    Expandableblocks

    14.4.3, Figures 14.7, 14.8, page 504

  • 8/6/2019 14 Store

    27/53

    2 7

    RAID StructureRAID Redundant Array of Independent Disks Provides reliability via redundancy . Inexpensive disks no longer the issue

    Reliability E.g. if mean time between failures (MTBF) is 100,000

    hours for a disk, and there are 100 disks, then a disk

    fails every 1000 hours = 40 days E.g. in a mirrored two-disk system, if MTBF =100,000 hours and mean time to repair is 10 hours,then mean time to data loss is 100,000 2 /(2* 10) =57,000 years.

    14.5, 14.5.1, Page 505

  • 8/6/2019 14 Store

    28/53

    2 8

    RAID Disk striping for speed of reading

    Split bits of each byte across several disks, or Place sequential blocks on different disks Speed increase by parallel access A group of disks work as one storage unit.

    RAID schemes improve performance andimprove the reliability of the storage system bystoring redundant data. M irroring or shadowing keeps duplicate of each disk. Block int e rl e a ve d parity uses much less redundancy.

    14.5. 2 , Page 506

  • 8/6/2019 14 Store

    29/53

    2 9

    RAID Levels0. Block level striping with no redundancy1. Disk mirroring, keeping a second copy of data2 . Bit level striping, with error correction bits

    3. Error checking parity bits all on one disk 4. Block interleaves with parity block on one disk 5. Block interleaves with distributed parity6. Error-correcting codes rather than parity bits

    0. for high performance, less reliability0 + 1 and 1 + 0 for performance plus reliability5. For reliable storage of large data volume

    14.5.3, Pages 507 510

  • 8/6/2019 14 Store

    30/53

    30

    RAIDLevels

    14.5.3, Figure 14.9, Page 507

  • 8/6/2019 14 Store

    31/53

    31

    RAID (0 + 1) and (1 + 0)

    14.5.3, Figure 14.10, Page 511

  • 8/6/2019 14 Store

    32/53

    32

    Disk Attachment Local

    Host-attached storage via local I/O IDE, two disks per bus SCSI, 16 disks FC serial architecture, > 1 2 8 disks

    Network Network Attached Storage (NAS)

    NFS for UNIX, CIFS for Windows RPCs carried over TCP/IP or UDP/IP Convenient, but less efficient than local

    14.6, Pages 51 2 513

  • 8/6/2019 14 Store

    33/53

    33

    Network-Attached Storage

    14.6, Figure 14.11, Page 513

  • 8/6/2019 14 Store

    34/53

    34

    Storage-Area Network

    Private network with storage protocols rather than network protocols, takes load off LAN.

    14.6, Figure 14.1 2 , Page 514

  • 8/6/2019 14 Store

    35/53

    35

    Stable-Storage Implementation Write-ahead log scheme requires stable

    storage.

    To implement stable storage: Replicate information on more than one

    nonvolatile storage media with independent

    failure modes. Update information in a controlled manner to

    ensure that we can recover the stable data after any failure during data transfer or recovery.

    14.7, Page 515

  • 8/6/2019 14 Store

    36/53

    36

    Tertiary Storage Devices Low cost is the defining characteristic of

    tertiary storage.

    Generally, tertiary storage is built usingr e movabl e me dia

    E.g. floppy disks, CD-ROMs, tapes

    14.8.1, Page 516

  • 8/6/2019 14 Store

    37/53

    37

    Removable Disks Floppy disk thin flexible disk coated

    with magnetic material, enclosed in a protective plastic case.

    Most floppies hold about 1 MB; similar technology is used for removable disks that

    hold more than 1 GB. Removable magnetic disks can be nearly as

    fast as hard disks, but they are at a greater risk of damage from exposure.

    14.8.1.1, Page 516

  • 8/6/2019 14 Store

    38/53

    38

    Removable DisksA magn e to-optic disk records data on a rigid platter coated with magnetic material. Laser heat is used to make a disk spot susceptible to a

    weak magnetic field to record a bit. Laser light is also used to read data by polarization

    rotation in disk spot magnetic field (Kerr effect).

    Optical disks employ special materials that arealtered by laser light. E.g. crystalline surface is transparent, amorphous

    surface is reflective Low power laser reads, medium power melts to

    crystalline, high power melts to amorphous14.8.1.1, Page 516

  • 8/6/2019 14 Store

    39/53

    39

    WORM Disks The data on read-write disks can be modified over

    and over. WORM (Write Once, Read Many Times) disks

    can be written only once.

    Thin aluminum film sandwiched between twoglass or plastic platters. To write a bit, the drive uses a laser light to burn a

    small hole through the aluminum; information can

    be destroyed but not altered. Very durable and reliable.Re ad Only disks, such as CD-ROM and DVD,come from the factory with the data pre-recorded.

    14.8.1.1, Page 517

  • 8/6/2019 14 Store

    40/53

    40

    Digital Versatile Disks

    Dual-layer DVD (17 G B)

    Semi-reflective layer Aluminum reflector

    0.4 micron pits, 0.74 Q between tracks, 0.65 Q laser

    0.8 micron pits, 1.6 Q between tracks, 0.78 Q laser

    Tanenbaum, Figure 5- 2 3, Page 314

  • 8/6/2019 14 Store

    41/53

    41

    Tapes Compared to a disk, a tape is less expensive and holds

    more data, but random access is much slower. Tape is an economical medium for purposes that do not

    require fast random access, e.g., backup copies of disk

    data, holding huge volumes of data. Large tape installations typically use robotic tape changers

    that move tapes between tape drives and storage slots in atape library.

    stacker library that holds a few tapes silo library that holds thousands of tapes

    A disk-resident file can be archi ve d to tape for low coststorage; the computer can stag e it back into disk storagefor active use.

    14.8.1. 2 , Page 517

  • 8/6/2019 14 Store

    42/53

    42

    Operating System Issues Major OS jobs

    manage physical devices present a virtual machine abstraction to

    applications

    For hard disks, the OS provides twoabstraction: Raw device an array of data blocks. File system the OS queues and schedules the

    interleaved requests from several applications.

    14.8. 2 , Page 519

  • 8/6/2019 14 Store

    43/53

    43

    Application Interface Most OSs handle removable disks almost exactly like

    fixed disks a new cartridge is formatted and an emptyfile system is generated on the disk.

    Tapes are presented as a raw storage medium, i.e., andapplication does not not open a file on the tape, it opensthe whole tape drive as a raw device.

    Usually the tape drive is reserved for the exclusive use of that application.

    Since the OS does not provide file system services, theapplication must decide how to use the array of blocks. Since every application makes up its own rules for how to

    organize a tape, a tape full of data can generally only beused by the program that created it.

    14.8. 2 .1, Page 519

  • 8/6/2019 14 Store

    44/53

    44

    Tape Drives The basic operations for a tape drive differ from those of a

    disk drive.locate positions the tape to a specific logical block, not anentire track (corresponds to seek ).

    The read position operation returns the logical block number where the tape head is.

    The space operation enables relative motion. Tape drives are append-only devices; updating a block

    in the middle of the tape also effectively erases everything beyond that block.

    An EOT mark is placed after a block that is written.

    14.8. 2 .1, Page 5 2 0

  • 8/6/2019 14 Store

    45/53

    45

    File Naming The issue of naming files on removable media is

    especially difficult when we want to write data ona removable cartridge on one computer, and then

    use the cartridge in another computer. Contemporary OSs generally leave the namespace problem unsolved for removable media, anddepend on applications and users to figure outhow to access and interpret the data.

    Some kinds of removable media (e.g., CDs) areso well standardized that all computers use themthe same way.

    14.8. 2 .2 , Page 5 2 0

  • 8/6/2019 14 Store

    46/53

    46

    Hierarchical Storage Management (HSM)

    A hierarchical storage system extends the storagehierarchy beyond primary memory and secondarystorage to incorporate tertiary storage usuallyimplemented as a juk e bo x of tapes or removable

    disks. Usually incorporate tertiary storage by extendingthe file system. Small and frequently used files remain on disk. Large, old, inactive files are archived to the jukebox.

    HSM is usually found in supercomputing centersand other large installations that have enormousvolumes of data.

    14.8. 2 .3, Page 5 2 1

  • 8/6/2019 14 Store

    47/53

    47

    Speed

    Two aspects of speed in tertiary storage are bandwidth and latency.

    Bandwidth is measured in bytes per second. Sustained bandwidth average data rate during a large

    transfer; # of bytes/transfer time.Data rate when the data stream is actually flowing.

    Effective bandwidth average over the entire I/O time,including seek or locate , and cartridge switching.Drives overall data rate.

    14.8.3.1, Page 5 22

  • 8/6/2019 14 Store

    48/53

    48

    Speed Access latency amount of time needed to locate data.

    Access time for a disk move the arm to the selected cylinder and wait for the rotational latency; < 35 milliseconds.

    Access on tape requires winding the tape reels until the selected

    block reaches the tape head; tens or hundreds of seconds. Generally, random access within a tape cartridge is about a

    thousand times slower than random access on disk.

    The low cost of tertiary storage is a result of havingmany cheap cartridges share a few expensive drives.

    A removable library is best devoted to the storage of infrequently used data, because the library can onlysatisfy a relatively small number of I/O requests per hour.

    14.8.3.1, Page 5 22

  • 8/6/2019 14 Store

    49/53

    49

    Reliability A fixed disk drive is likely to be more reliable

    than a removable disk or tape drive.

    An optical cartridge is likely to be more reliablethan a magnetic disk or tape.

    A head crash in a fixed hard disk generallydestroys the data, whereas the failure of a tapedrive or optical disk drive often leaves the datacartridge unharmed.

    14.8.3. 2 , Page 5 2 3

  • 8/6/2019 14 Store

    50/53

    50

    Cost Main memory is much more expensive than disk storage

    The cost per megabyte of hard disk storage is competitivewith magnetic tape if only one tape is used per drive.

    The cheapest tape drives and the cheapest disk drives havehad about the same storage capacity over the years.

    Tertiary storage gives a cost savings only when thenumber of cartridges is considerably larger than thenumber of drives.

    14.8.3.3, Page 5 2 4

  • 8/6/2019 14 Store

    51/53

    51

    Price per Megabyte of DRAM1981 2 000

    10 3

    14.8.3.3, Figure 14.13, Page 5 2 4

  • 8/6/2019 14 Store

    52/53

    52

    Price per Megabyte of Magnetic Hard Disk,1981 2 000

    10 4

    14.8.3.3, Figure 14.14, Page 5 2 5

  • 8/6/2019 14 Store

    53/53

    53

    Price per Megabyte of a Tape Drive,

    1984 2

    000

    10 3

    14 8 3 3 Fi 14 15 P 5 2 6