Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views22 pages

Disk Management

The document provides an overview of disk management, including mass storage structures, disk scheduling algorithms, and swap-space management. It details various disk scheduling methods such as FCFS, SSTF, SCAN, and C-SCAN, along with their advantages and disadvantages. Additionally, it discusses disk formatting, bad block management, and the use of swap space in virtual memory systems.

Uploaded by

sambit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views22 pages

Disk Management

The document provides an overview of disk management, including mass storage structures, disk scheduling algorithms, and swap-space management. It details various disk scheduling methods such as FCFS, SSTF, SCAN, and C-SCAN, along with their advantages and disadvantages. Additionally, it discusses disk formatting, bad block management, and the use of swap space in virtual memory systems.

Uploaded by

sambit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Disk Management

1
Outline…
Overview of mass storage structure
Disk Structure
Disk Scheduling
 FCFS Scheduling
 SSTF Scheduling
 SCAN Scheduling
 CSCAN Scheduling
 LOOK Scheduling
 CLOOK Scheduling
Disk Management
Swap-Space Management

2
Overview of Mass Storage Structure
Magnetic disks provide bulk of secondary storage of modern
computers
– Drives rotate at 60 to 200 times per second
– Transfer rate is rate at which data flow between drive and
computer
– Head crash results from disk head making contact with
the disk surface which is not good.
Disks can be removable
Drive attached to computer via I/O bus

3
Moving-head Disk Mechanism

4
Overview of Mass Storage Structure
contd…
Magnetic tape
– Was early secondary-storage medium
– Relatively permanent and holds large quantities of data
– Access time slow
– Mainly used for backup, storage of infrequently-used
data, transfer medium between systems
– 20-200GB typical storage

5
Disk Structure
Disk drives are addressed as large 1-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.
The 1-dimensional array of logical blocks is mapped into the
sectors of the disk sequentially.
– Sector 0 is the first sector of the first track on the outermost
cylinder.
– 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.
– But in practice this mapping is too difficult due to some
defective sectors and the number of sectors per track is not a
constant on some drives.

6
Disk Scheduling
The operating system is responsible for using hardware efficiently
— for the disk drives, this means having a fast access time and
disk bandwidth.
Access time has two major components :
– Seek time is the time for the disk to move the heads to the cylinder
containing the desired sector.
– Rotational latency is the additional time waiting for the disk to
rotate the desired sector to the disk head.
Minimize seek time
Seek time  seek distance
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.

7
Disk Scheduling contd…
For a multiprogramming system with many processes, the
disk queue may often have several pending requests.
Thus, when one request is completed the operating
system chooses which pending request to service next.
Several algorithms exist to schedule the servicing of disk
I/O requests.
We illustrate them with a request queue (0-199).

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

Head pointer 53

8
FCFS scheduling
It doesn’t provide the fastest service.
Illustration shows total head movement of 640 cylinders.

9
SSTF Scheduling
SSTF stands for shortest-seek-time-first.
Selects the request with the minimum seek time
from the current head position.
Since, seek time increases with the number of
cylinders traversed by the head, SSTF chooses
the pending request closest to the current head
position
SSTF scheduling is a form of SJF scheduling; may
cause starvation of some requests.
Illustration shows total head movement of 236
cylinders.
10
SSTF contd…

11
SCAN Scheduling
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.
Before applying SCAN to schedule the requests on
cylinders, we have to know the direction of head
movement corresponding to the head’s current position.
If a request arrives in the queue just in front of the head,
it will be serviced almost immediately; but if a request
arriving just behind the head will have to wait until the
arm moves to the end of the disk, reverses direction, and
comes back.
Sometimes called the elevator algorithm.
Illustration shows total head movement of 208 cylinders.

12
SCAN contd…

13
C-SCAN Scheduling
Circular SCAN (C-SCAN) scheduling is a variant of
SCAN designed to provides a more uniform wait
time.
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.
14
C-SCAN contd…

15
C-LOOK
Neither SCAN or C –SCAN are implemented
the ways we described.
Arm only goes as far as the final request in
each direction, then reverses direction
immediately, without going all the way to the
end of the disk.
These version of SCAN and C-SCAN are called
LOOK and C-LOOK scheduling, because they
look for a request before continuing to move
in a given direction.

16
C-LOOK contd…

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, because occurrence of starvation
is minimal.
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 of the operating system, allowing it to be
replaced with a different algorithm if necessary.
Either SSTF or LOOK is a reasonable choice for the default
algorithm.

18
Disk Management
Disk formatting
Before a disk can store data, it must be divided into sectors that
the disk controller can read and write. This process is called low-
level formatting (or physical formatting).
Low-level formatting fills the disk with special data structure for
each sector and each sector typically consists of a header, a data
area, and a trailer.
The header and trailer contain information like sector number and
error-correcting code (ECC), which is used by disk controller.
Most hard disks are low-level formatted at the factory as a part of
the manufacturing process.
To use a disk to hold files, the operating system does it in two
ways: 1st step is to partition the disk into one or more groups of
cylinders, and 2nd step is logical formatting (or creation of a file
system).
19
Disk Management contd…
Boot Block

Bootstrap program loads the operating system kernel into


the main memory and initializes all aspects of the system.
For most computers, the bootstrap program is stored in
ROM.
But, the problem is that changing this bootstrap code
requires changing the ROM hardware chips.
For this reason most computer store a tiny bootstrap
loader program in the boot ROM whose only job is to
bring the full bootstrap program from disk.
The full bootstrap program is stored in a partition called
boot blocks, at a fixed location on the disk.
A disk that has a boot partition is called a boot disk or a
system disk.
20
Disk Management contd…
Bad Blocks
Sometimes one more sectors become defective. Even most of the
disk come from factory with defective blocks.
These defective blocks are called bad blocks.
These bad sectors or blocks can’t be used, even the data stored in
these blocks will be lost.
So the work of operating system is to replace that bad block.
Two methods are there:
– Sector sparing or forwarding: low-level formatting can also have
some spare sectors, which is not visible to the OS. The controller can
replace each bad sector logically with one of the spare sector.
– Sector slipping : the concept is similar to insert a new element in
an array of fixed size. Replacement blocks 1 by 1.

21
Swap-Space Management
Swap-space — Virtual memory uses disk space as an extension
of main memory.
Swap space is used in various ways by different operating system,
depending on the implemented memory-management algorithms.
Even the amount of swap space is needed on a system is
depending on the amount of physical memory, and the amount of
virtual memory it is backing.
A swap-space can be reside in two places:
– It can be carved out of the normal file system. (file system
routines can be used to create it, name it and allocate its
space)
– This approach is simple but inefficient.
– it can be in a separate disk partition. (A separate swap-space
storage manager is used to allocate and de-allocate the blocks)

22

You might also like