Princess Nora University Faculty of Computer Information Systems

  • Slides: 19
Download presentation
Princess Nora University Faculty of Computer & Information Systems Computer science Department Operating Systems

Princess Nora University Faculty of Computer & Information Systems Computer science Department Operating Systems (CS 340 D)

Mass Storage Structure

Mass Storage Structure

Chapter 10: Mass Storage Structure 1. Overview of Mass Storage Structure 2. Disk Structure

Chapter 10: Mass Storage Structure 1. Overview of Mass Storage Structure 2. Disk Structure 3. Disk Scheduling Algorithms 3

OBJECTIVES: Ø To describe the physical structure of secondary storage devices and its effects

OBJECTIVES: Ø To describe the physical structure of secondary storage devices and its effects on the uses of the devices. Ø To explain the performance characteristics of mass-storage devices and it scheduling algorithms 4

Overview 5

Overview 5

Moving-head Disk Mechanism q. Each disk platter has a flat circular shape, like a

Moving-head Disk Mechanism q. Each disk platter has a flat circular shape, like a CD q. The surface of a platter is logically divided into circular tracks, which are subdivided into sectors. q The set of tracks that are at one arm position makes up a cylinder. 6

Overview of Mass Storage Structure q Magnetic disks provide bulk of secondary storage of

Overview of Mass Storage Structure q Magnetic disks provide bulk of secondary storage of modern computers Ø Ø Drives rotate at 60 to 200 times per second Disk speed has two parts. v Transfer rate is rate at which data flow between drive and computer v Positioning time (/random-access time) consists of : § seek time : time to move disk arm to desired cylinder § rotational latency : time for desired sector to rotate under the disk head q Disks can be removable 7

Overview of Mass Storage Structure (cont. ) q Disk drive attached to computer via

Overview of Mass Storage Structure (cont. ) q Disk drive attached to computer via set of wires (I/O bus) q The data transfers on a bus are carried out by special electronic processors called controllers. Ø Ø Ø 8 The host controller is the controller at the computer end of the bus. A disk controller is built into each disk drive To perform disk I/O operation >> Host controller uses bus to talk to disk controller.

Disk Structure 9

Disk Structure 9

Disk Structure q Disk drives are addressed as large 1 -D arrays of logical

Disk Structure q Disk drives are addressed as large 1 -D arrays of logical blocks, where the logical block is the smallest unit of transfer q The 1 -D array of logical blocks is mapped into the sectors of the disk sequentially 10 Ø Sector 0 is the first sector of the first track on the outermost cylinder Ø 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 11

Disk Scheduling 11

Disk Scheduling q The operating system is responsible for using hardware efficiently Ø for

Disk Scheduling q The operating system is responsible for using hardware efficiently Ø for the disk drives>> this means having a fast access time and large disk bandwidth q Access time has two major components Ø Seek time Ø Rotational latency q 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 q We can improve both the access time and the bandwidth by managing the order in which disk I/O requests are serviced. Ø Minimize seek time (Seek time ≈ seek distance) 12

Disk Scheduling Algorithms q Some algorithms to schedule the servicing of disk I/O requests:

Disk Scheduling Algorithms q Some algorithms to schedule the servicing of disk I/O requests: Ø FCFS (first-come, first-served): Ø SSTF (shortest-seek-time-first )algorithm Ø SCAN 13

Disk Scheduling Algorithms q Algorithm (1): FCFS (first-come, first-served): v (slowly & simple) v

Disk Scheduling Algorithms q Algorithm (1): FCFS (first-come, first-served): v (slowly & simple) v EXAMPLE: • A disk drive has 200 cylinders, The queue of pending requests is: 98, 183, 37, 122, 14, 124, 65, 67 The current head position= 53 • • � Head movement sequence: 53 » 98 » 183 » 37 » 122 » 14 » 124 » 65 » 67 � The total seek distance = ∑ │ current position- next position│ = 45 +85 + 146 + 85 +108+110 +59+2 =640 cylinders. 14

Disk Scheduling Algorithms (Cont. ) q Algorithm (2): SSTF (shortest-seek-time-first )algorithm v Selects the

Disk Scheduling Algorithms (Cont. ) q Algorithm (2): SSTF (shortest-seek-time-first )algorithm v Selects the request with the minimum seek time from the current head position (i. e. service all the requests close to the current head position before moving the head far away to service other requests) v SSTF scheduling is a form of SJF scheduling; may cause starvation of some requests v SSTF is not optimal 15

Disk Scheduling Algorithms (Cont. ) v EXAMPLE: SSTF algorithm A disk drive has 200

Disk Scheduling Algorithms (Cont. ) v EXAMPLE: SSTF algorithm A disk drive has 200 cylinders, The queue of pending requests is: 98, 183, 37, 122, 14, 124, 65, 67 The current head position= 53 • • • � Head movement sequence: 53 » 65 » 67 » 37 » 14 » 98 » 122 » 124 » 183 � The total seek distance = ∑ │ current position- next position│ =236 cylinders…. (better than FCFS algorithm) 16

Disk Scheduling Algorithms (Cont. ) Ø Algorithm (3): SCAN algorithm o The disk arm

Disk Scheduling Algorithms (Cont. ) Ø Algorithm (3): SCAN algorithm o 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. o SCAN algorithm Sometimes called the elevator algorithm o Before applying SCAN to schedule we need to know the direction of head movement 17

Disk Scheduling Algorithms (Cont. ) v EXAMPLE: SCAN algorithm • • • A disk

Disk Scheduling Algorithms (Cont. ) v EXAMPLE: SCAN algorithm • • • A disk drive has 200 cylinders (0 -199) The queue of pending requests is: 98, 183, 37, 122, 14, 124, 65, 67 The current head position= 53 � Assuming that head direction: from cylinder# 199 to cylinder #0 (C 199 >>C 0) � Head movement sequence: 53 » 37 » 14 » 0 » 65 » 67 » 98 » 122 » 124 » 183 � The total seek distance = ∑ │ current position- next position│ =16+23+14+65+2+31+24+2+59 = 236 cylinders NOTE: if we reverse the direction, the result almost will be different. 18

Thank you The End 19

Thank you The End 19