IO Management and Disk Scheduling

advertisement

IO Management and Disk

Scheduling

B. Ramamurthy

B.Ramamurthy

1

Introduction

 In addition to primary memory (volatile), computer systems provide users secondary storage units which may be used for persistent (or permanent) storage.

 A file is a collection of data elements grouped together for the purposes of access control, retrieval and modification.

 A file system together with IO management subsystem accomplish the mapping of abstract user interface into the actual collection of hardware such as disk, tape etc. of varying characteristics.

 Recently there has been lot of interest in a storage medium called RAID. We will look into this (11.6)

 We will study IO management in this discussion (Ch.11) and File system in the next chapter (Ch. 12)

B.Ramamurthy

2

Topics for discussion

 IO devices

 Device Characteristics

 IO Design Objectives

 A model of IO Organization

 Buffering

 Disk IO

 Disk scheduling

 Disk cache

 RAID storage

 Summary

B.Ramamurthy

3

IO Devices

 IO devices can be grouped into three categories:

 Human readable: Suitable for use with computer user. Example: video display terminals, keyboard, mouse and printers.

 Machines readable: Example: disks, tapes, sensors, controllers.

 Communication: Suitable for communicating with remote devices: Drivers, modems, sockets, etc.

B.Ramamurthy

4

Device Characteristics

 Devices vary widely in characteristics such as: Data rate, applications, complexity of control, unit of transfer, data representation, Error conditions.

 Programmed IO , Interrupt-driven IO and

Direct-memory access are three techniques for performing IO.

B.Ramamurthy

5

IO Design Objectives

 Efficiency : IO operations often form the bottleneck in a computing system.

 Generality: Handle all devices in a uniform manner.

How?

 Use hierarchical, modular approach to design of IO subsystem.

 This approach hides most of the details of device details in lower-levels so that processes and upper levels of OS see devices in terms of general functions such as Read, Write, Open, Lock, UnLock etc.

B.Ramamurthy

6

A Model of IO Organization

User Processes User Processes User Processes

Logical IO

Comm. Arch.

Device IO

Sched &

Control

Device IO

Sched &

Control

Hardware Hardware

Local Peripheral Device Comm Port

Dir. Mgt.

File System

Physical Org.

Device IO

Sched. &

Control

Hardware

File System

7

Buffering

 In order to avoid inefficiencies associated with direct transfer from user-process to IO device, buffering schemes can be used.

 Buffering smoothes out the peaks in IO demand.

 Buffering depends on the type of IO device:

Block-oriented (Ex: disks) and Stream-oriented

(terminal, comm. ports).

 Stream-oriented IO: single buffering;

 Block-oriented Devices: double buffer, circular buffer

B.Ramamurthy

8

Disk IO

 A disk contains a stack of recording surfaces each surface with a movable read/write head.

 Each surface has circular tracks and each track divided into sectors. A stack of tracks make up a cylinder.

 To read or write, the head must be positioned at the desired track and at the beginning of the desired sector.

B.Ramamurthy

9

Disk IO

 Seek Time (Ts) is the time it takes to position the head at the desired track.

 Rotational Delay (Tr) is the time it takes to to line up the head at the beginning of the desired sector.

 Access Time (Ta ) = Ts + Tr

 The data transfer time (Tt) is the time to read/write data at the desired position.

B.Ramamurthy

10

Disk Scheduling

 Among the times Seek time is the most critical. Average access time can be improved by reducing the average

Seek Time.

 Assumption: A queue of requests for each IO device is maintained. At any time a number of requests from various processes are in the queue. Consider a sequence of n-requests for scheduling.

 Example: Tracks: 55, 58, 39, 18, 90, 160, 150, 38

 Using FIFO, SSTF, SCAN, C-SCAN. Table 11.3, Fig.11.7

B.Ramamurthy

11

Disk Cache

 A disk cache is a buffer in main memory for disk sectors.

 Cache contains a copy of the some of the sectors on the disk.

 When a IO request is made for a particular sector, if the data is available on disk cache it is taken. Otherwise it can be brought into the cache from the disk.

 Similar to virtual memory principles. Directory blocks are good candidates for caching.

B.Ramamurthy

12

Redundant Array of

Independent Disks (RAID)

 Is a set of disk drives viewed by operating system as a single logical device.

 Data are distributed across the physical drives of an array.

 Redundant disk capacity is used to store parity information, which guarantees data recoverability in case of disk failure.

 Raid levels 0 to 7

B.Ramamurthy

13

RAID Levels

 RAID 0 - striping

 RAID 1 - Mirrored

 RAID 2 - Error correcting using Hamming code

 RAID 3 - bit-interleaved parity

 RAID 4 - Block-interleaved parity (independent access)

 RAID 5 - Block-interleaved parity (independent access)

 RAID 6 - P + Q redundancy

 RAID 7 - heterogeneous devices

B.Ramamurthy

14

RAID (contd.)

 Unique contribution of the RAID is to address the need for redundancy.

 Principle : redundancy + compensate for reduced reliability

 Even though use of multiple heads and actuators result in higher transfer rates, they also introduce higher probability of failure.

 To compensate for this decreased reliability,

RAID makes use of stored parity information to recover data lost due to disk failure.

B.Ramamurthy

15

RAID 1

 RAID 0 : data is “striped” across many disks similar to interleaved memory.

 Not actually RAID.

 No redundancy but high transfer rate due to organization.

 RAID 1 : redundancy is achieved by simple duplicating.

 Read can be performed by either disk which ever has lower seek and rotational time.

 Write can be performed simultaneous on the two disks.

 Recovery from failures is simple: use the surviving disk.

B.Ramamurthy

16

RAID 2

 RAID 2 - RAID 5 have some kind of parity.

 RAID 2 :

 striping

 Hamming error correcting code

 4 data disks , 3 Hamming code disks

 Effective in environment which are error prone.

B.Ramamurthy

17

RAID 3

 Similar to RAID but only one single redundant disk.

 Single redundant disk contains the parity info of the bits across the four disks.

 Single disk failure can be tolerated with slightly lower transfer rate until the failed disk is replaced.

B.Ramamurthy

18

RAID 4 and 5

 Independently accessible.

 Strip parity (text calls it block parity).

 Large strips.

 In RAID 4 parity is stored on a single disk, and in RAID 5 parity is distributed over disks.

B.Ramamurthy

19

RAID 6 and RAID 7

 RAID 6 : real fault tolerance hardware included. Significantly more expensive than RAID 5.

 RAID 7 : using distributed and heterogenous sources of data.

B.Ramamurthy

20

Summary

 Look at exercises 11.1, 11.2, 11.7, 11.8

 Hardware characteristics underlying IO devices are abstracted for presenting easier-to-use and uniform logical interface to the processes.

 Performance improvement is another important objective which is achieved through buffering schemes and scheduling algorithms.

B.Ramamurthy

21

Download