chapter 12: mass-storage systems (storage management-secondary storage)

Post on 21-Jan-2016

233 Views

Category:

Documents

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Chapter 12: Mass-Storage SystemsChapter 12: Mass-Storage Systems(Storage Management-Secondary storage)(Storage Management-Secondary storage)

12.2 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Chapter 12: Mass-Storage SystemsChapter 12: Mass-Storage Systems

Disk Structure

Disk Scheduling

Disk Management

Swap-Space Management

RAID Structure

Disk Attachment

Stable-Storage Implementation

Tertiary Storage Devices

12.3 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

IntroductionIntroduction

Secondary storage devices provide non-volatile, permanent mass storage capabilities.

They come in a variety of types including hard disks, floppy disks, CDs,DVDs,magnetic tapes, pen-drives, etc.

The most common used device for storing very large information permanently is the Hard disk or simple called Disk.

12.4 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk StructureDisk Structure

There is two types of Disk structure.

Physical Structure

Logical Structure.

12.5 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Physical Geometry of a DiskPhysical Geometry of a Disk

12.6 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Physical structurePhysical structure

Previous slid figure depicts the physical geometry of a hard disk.

A hard disk is a sealed unit. It contains one or more circular platters. Each platters contains magnetic coating on both of its

surfaces. They rotate together round a central spindle. Rotation speed is normally 3600,5400 or 7200 rpm

(Rotation per Minute). Normally disks contain 1 to 8 platters. Each platter contains two surfaces (one above and other

below)

12.7 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Physical structurePhysical structure

Data is read from and written to these platters using a number of read/write heads.

Normally there are as many heads as surfaces in disk.

Each of these heads is attached to an arm. An arm can be moved in order to access

different parts of the platter. A platter can be thought of as a collection of

circular, concentric, flat rings. This rings are called tracks. Data is stored on the surface of a platter inside

these tracks in form of bits (0 or 1).

12.8 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Physical structurePhysical structure

Normally there are more than thousands of tracks on a single surface.

Each track is divided into a fixed size blocks, called sectors.

Normally each sector is of 512 bytes and there are hundreds of sectors on a single track.

Sectors a smallest physical storage unit on a disk.

Read and write operations are performed in number of sectors on disk.

Group of tracks with the same radius are called cylinders.

12.9 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Physical structurePhysical structure

Here, each track is on a different platter. And each track can be accesses without

moving the read/write head of a disk. Number of cylinders are same as that of

tracks.

12.10 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Logical structureLogical structure

Here, disk is considered as a large one dimensional array of fixed size logical blocks.

Size can be varied from system to system.

Normally, the size will be of 512 bytes.

These blocks are numbered to identify them uniquely on a disk.

Numbering starts from ‘0’ or ‘1’ to some maximum.

Total number of blocks depends upon a storage capacity of a disk and the size of a block.

12.11 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Logical structureLogical structure

The OS considers disk in this form as depicted in bellow figure.

Here, blocks are considered as the smallest unit of data transfer between disk and main memory.

Whenever any file storage space it is allocated one or more blocks either contiguously or non-contiguously as per the allocation method.

0 1 2 … N-1

12.12 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Logical structureLogical structure

Whenever there is a need to access any information from disk, OS system specifies a logical block number.

This logical block number is mapped to a physical cylinder number, head number and sectors number.

12.13 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Constant Linear velocity Constant Linear velocity v/s v/s

Constant Angular velocity Constant Angular velocity

As read/write head moves from inner track to outer track, track length increases.

Due to this reason, outer tracks can hold more sectors compared to inner tracks.

Another factor is as head moves towards outer tracks, the rate of data moving under this head also increases.

These two factors affect the amount of data that can be accessed in particular time duration.

12.14 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Constant Linear velocity Constant Linear velocity v/s v/s

Constant Angular velocityConstant Angular velocity

In other words, data rate varies over different tracks.

But to keep disk operations simple, data rate should be constant.

To over come this problem, there are two Methods which provide constant data rate. Constant Linear velocity Constant Angular velocity

12.15 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Constant Linear Velocity (CLV)Constant Linear Velocity (CLV)

Here, density of bits per track is kept uniform.

So outer tracks hold more amounts of data compared to inner tracks.

To keep data rate constant, this method increases disk rotation speed as read/write head moves from outer track to inner track.

This method is known as constant linear velocity (CLV).

It is used in CD-ROMs and DVDs.

12.16 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Constant Angular velocityConstant Angular velocity

Here, the disk rotation speed is kept constant.

But density of bits per track is not uniform.

To keep data rate constant this method decreases density of bits from inner track to outer track.

So, outer tracks hold same amount of data as inner tracks.

This methods is known as constant angular velocity (CAV).

It is used in hard disks.

12.17 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk SchedulingDisk Scheduling

Whenever any process needs to perform I/O operation to or from the disk, it requests OS to provide service.

System calls are used for this purpose. The request consists of the following

information :1. Whether operation is read (input) operation

or write (output) operation2. The disk address for data transfer3. The memory address for data transfer and4. The amount of data to be transferred.

12.18 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk SchedulingDisk Scheduling

if the disk and disk controller are free, request will be served immediately.

Else, the request will be placed in the device queue.

When current request completes, one of the pending requests is selected to be served by a Operating System.

Disk scheduling is the process of making choice of which pending read/write request to serve next when the current request completes.

The primary goal of disk scheduling is to serve all I/O (read/write) requests efficiently.

12.19 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk SchedulingDisk Scheduling

The total time required to complete any read or write operation depends upon the following three factors: Seek time : time required to move the

read/write head to the proper cylinder. Rotation Latency (Delay): this required for

the proper sector to rotate under the head. Actual time to transfer data.

Here, seek time dominates the other two times. Because of this, reducing the average seek

time improves the performance considerably.

12.20 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk Scheduling AlgorithmsDisk Scheduling Algorithms

These algorithms are used to select one of the pending I/O request when the currently request completes.

There are mainly six disk scheduling algorithms available as given below:

FCFS (First Come First Serve) Scheduling

SSTF (Shortest Seek Time First) Scheduling

SCAN Scheduling

LOOK Scheduling

C-SCAN Scheduling

C-LOOK Scheduling

12.21 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

FCFS (First Come First Serve) FCFS (First Come First Serve) SchedulingScheduling

Selection Criteria : Serves the requests in the same order as

they are received. The request which came first, will be

served first. Order of pending requests :

We illustrate them with a request queue (0-99).

98, 183, 37, 122, 14, 124, 65, 67Head pointer 53

12.22 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

FCFSFCFS Order in which requests will be served :

98, 183, 37, 122, 14, 124, 65, 67 Total head movement:

(98-53)+(183-98)+(183-37)+(122-37) +(122-14)+(124-14)+(124-65)+(67-65) 45+85+146+85+108+110+59+2=640

cylinders

12.23 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

FCFSFCFS

Illustration shows total head movement of 640 cylinders.

12.24 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

FCFSFCFS

Advantages :

Simple, Fair to all request

Disadvantages :

Not Efficient, because the average seek time is very high.

12.25 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SSTF (Shortest Seek Time First) SSTF (Shortest Seek Time First) SchedulingScheduling

Selection Criteria : Serve the request which involves minimum

seek time from the current position of the read/write head.

So the request for cylinder number, which is closest to the current head position, will be served first.

Order of pending requests : We illustrate them with a request queue (0-

99).

98, 183, 37, 122, 14, 124, 65, 67

Head pointer 53

12.26 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SSTFSSTF Order in which requests will be served :

53,65,67,37,14,98,122,124,183 Total head movement:

(65-53)+(67-65)+(67-37)+(37-14) +(98-14)+(122-98)+(124-122)+(183-124) 12+2+30+23+84+24+2+59=236 cylinders

12.27 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SSTFSSTF

12.28 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SSTFSSTF

Advantages :

More efficient than FCFS algorithm

Disadvantages :

Starvation is possible for request involving longer seek time.

12.29 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SCAN SchedulingSCAN Scheduling

Selection Criteria : Keep scanning between two end points

of disk continuously. Serve the requests encountered on the way.

This algorithm is also known as an Elevator algorithm

Here, the disk arm (or head) starts at one end of the disk and moves toward the other end. It serves all the request coming in the way. After reaching other end, the direction of head movement is reversed and servicing continuous.

12.30 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SCAN SchedulingSCAN Scheduling

Order of pending requests : We illustrate them with a request queue

(0-99).98, 183, 37, 122, 14, 124, 65, 67

Head pointer 53

12.31 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SCAN SchedulingSCAN Scheduling Order in which requests will be served :

53,37,14,0,65,67,98,122,124,183 Total head movement:

(53-37)+(37-14)+(14-0)+(65-0)+(67-65) +(98-67)+(122-98)+(124-122)+(183-124) 16+23+14+65+2+31+24+22+59=236cylinde

rs

12.32 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SCAN SchedulingSCAN Scheduling

12.33 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

SCAN SchedulingSCAN Scheduling

Advantages : More efficient than FCFS algorithm Also there is no starvation for any requests.

Disadvantages : Requires extra head movement between two

extreme points. For example, after servicing 14th cylinder there is no need to visit 0th cylinder. But though this algorithm visits the end points.

Not so fair, cylinders which are just behind the head will wait longer.

12.34 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

LOOK SchedulingLOOK Scheduling Selection Criteria :

Keep scanning between two end points continuously. Serve the requests encountered on the way. But go only as far as the final requests in each direction.

This algorithm is same as that of SCAN but the difference is that here extreme points are not visited unnecessarily.

Order of pending requests : We illustrate them with a request queue (0-99).

55,90,15,60,5,65,30Head pointer 25

12.35 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

LOOK SchedulingLOOK Scheduling

Order in which requests will be served :25,15,5,30,55,60,65,90

Total head movement: 10+10+25+25+5+5+25=105 cylinder

12.36 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

LOOK SchedulingLOOK Scheduling

0 5 15 55 60 65 90 9925 30

12.37 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

LOOK SchedulingLOOK Scheduling

Advantages : More efficient than FCFS algorithm There is no starvation for any requests. Also there is no extra head movement in

visiting two extreme points unnecessarily. Disadvantages :

Not so fair, cylinders which are just behind the head will wait longer.

12.38 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

C-SCAN (circular-SCAN) SchedulingC-SCAN (circular-SCAN) Scheduling

Selection Criteria: Keep scanning from start to end of disk

continuously. Serve the requests encountered on the way.

This algorithm is same as SCAN algorithm, but it serves in one direction only. After reaching to end of the disk, it immediately returns to the beginning of the disk, without servicing any requests on the return trip.

12.39 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

C-SCAN (Cont.)C-SCAN (Cont.)

12.40 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

C-LOOK (circular-LOOK) SchedulingC-LOOK (circular-LOOK) Scheduling

Keep scanning from start to end of disk continuously. Serve the request encountered on the way. But go only as far as the final request in that direction.

This algorithm is same as LOOK algorithm, but it serves in one direction only. After reaching to final request, it immediately returns to the first request which is nearer to the beginning of the disk, without servicing any requests on the return trip.

12.41 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

C-LOOK (Cont.)C-LOOK (Cont.)

12.42 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Selecting Disk Scheduling AlgorithmsSelecting Disk Scheduling Algorithms

There are various scheduling algorithms available.

But now question is : which algorithm should be selected for actual use?

Here, some factors are given which affect the performance of a disk scheduling algorithm.

12.43 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Selecting Disk Scheduling AlgorithmsSelecting Disk Scheduling Algorithms

These factors are given as below :1. Number and type of requests:

Performance of a disk scheduling algorithm heavily depends upon the number and type of requests.

For example, if the device queue contains only one request, then all algorithms will behave the same. Because here, only one choice is available, all algorithms will behave like as FCFS algorithm.

12.44 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Selecting Disk Scheduling AlgorithmsSelecting Disk Scheduling Algorithms

2. File allocation method: File allocation method also has good

contribution in deciding performance. For example, when a contiguously

allocated file is accessed, the disk requests are normally close to each other. While for a linked or indexed file, disk blocks are scattered over disk, and disk head requires great movement.

12.45 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Selecting Disk Scheduling AlgorithmsSelecting Disk Scheduling Algorithms

3. Location of directories and index blocks: Every file must be opened before use.

For this there is need to search directory structure to determine location of files. So, directories are accessed frequently.

If the directory entry is on the first cylinder, and file data are on final cylinder then disk head requires to move the entire width of the disk.

12.46 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Selecting Disk Scheduling AlgorithmsSelecting Disk Scheduling Algorithms

These three factors should be considered while selecting an algorithm.

12.47 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk ManagementDisk Management

The operating system is responsible for several other aspect of disk management, too.

In that,

Disk Formatting (Disk initialization)

Booting from disk

Bad-block recovery

12.48 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Swap-Space ManagementSwap-Space Management

Swap-space management is another low-level task of the OS.

Virtual memory uses disk space as an extension of main memory.

Since disk access is much slower than memory access, using swap space significantly decreases system performance.

The main goal for the design and implementation of swap space is to provide the best throughput for the virtual-memory system.

12.49 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

RAID StructureRAID Structure

Full form of RAID is : “Redundant arrays of inexpensive disks”.

It is a disk organization techniques.

Advantages of RAID are:

Improvement of Reliability via Redundancy. e.g RAID-1

Improvement of Performance via Parallelism e.g RAID-0

12.50 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

RAID LevelsRAID Levels

RAID is arranged into six different levels.

12.51 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Disk AttachmentDisk Attachment

Computer access disk storage in two ways.

One way is via I/O port this is common on small systems.

The other way is via a remote host via a distributed file system, this is referred as a network-attached storage.

12.52 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Stable-Storage ImplementationStable-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.

12.53 Silberschatz, Galvin and Gagne ©2005Operating System Concepts

Tertiary-Storage StructureTertiary-Storage Structure

Low cost is the defining characteristic of tertiary storage.

So, in practice, tertiary storage is built with removable media.

The most common examples of removable media are floppy disks, CD-ROMs etc., many other kind of tertiary-storage devices are available as well.

End of Chapter 12End of Chapter 12

top related