0% found this document useful (0 votes)
9 views19 pages

OS - Unit 6

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

OS - Unit 6

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

1

Unit 6 : Storage Management

School of Computer Science


UPES, Dehradun
India
Table of Contents

 Disk Allocation Methods


 Disk Scheduling Algorithms
Disk Allocation Methods
An allocation method refers to how disk blocks are allocated for files:
Some of the commonly used methods are:
 Contiguous Allocation
 Linked Allocation
 Indexed Allocation
Contiguous Allocation
 Allocates a single contiguous set of blocks to a file.
• Characteristics:
• Simple and easy to implement.
• Provides fast access to file data.
• Can lead to external fragmentation.
• Difficult to find a contiguous block of space for large files.
• Advantages:
• Fast read/write access due to sequential block placement.
• Disadvantages:
• Can cause external fragmentation.
• Difficult to grow files if adjacent blocks are occupied.
Example Contiguous Allocation
Linked Allocation
Definition: Each file is a linked list of disk blocks, where each block contains a pointer to the
next block.
Characteristics:
No external fragmentation.
Only the block pointer is stored in each block.
Suitable for sequential access, not random access.
Advantages:
Simple to implement.
No need for contiguous space, reducing fragmentation.
Disadvantages:
Overhead of storing pointers.
Slower access times due to pointer traversal.
Example Linked Allocation
Indexed Allocation
 Definition: Uses an index block to keep track of the blocks allocated to a file.
 Characteristics:
 An index block contains pointers to all other blocks used by the file.
 Supports both sequential and random access efficiently.
 Advantages:
 No external fragmentation.
 Efficient access for both sequential and random reads.
 Disadvantages:
 Overhead of index block storage.
 Limited by the size of the index block.
Example Indexed Allocation
Disk Scheduling Algorithms
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 are 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.
Disk Scheduling Algorithms
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
FCFS (First Come First Served)
FCFS algo serves disk I/O requests in the
order they arrive as shown in figure.
Advantages
 Easy to implement
 [Fairness]: Every request has same
priority
 Preferred when simplicity is crucial
despite its potential inefficiency
Disadvantages
 Do not consider underline hardware
characteristics
 If requests are far apart we face long
waiting times due to high seek time
Illustration shows total head movement of 640 cylinders.
SSTF (Shortest Seek time first)
Pick the request from the queue with the
minimum seek time from the current head
position as shown in Figure.
Advantages:
By definition reduces total seek time
More efficient than FCFS in minimizing
seek time.
Disadvantages:
Can cause starvation and leads to unfairness
More complex to implement than FCFS.

[Starvation in SSFT]: When certain disk I/O


requests may be indefinitely delayed as shorter
seek time requests keep on arriving and taking
precedence.
SCAN (Elevator Algorithm)
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.

Advantages:
More efficient than FCFS and SSTF in
terms of overall seek time.
Provides a more uniform wait time.

Disadvantages:
Can still cause long wait times for requests
just missed on the sweep.
More complex to implement than FCFS.

Illustration shows total head movement of


208 cylinders.
C-SCAN (Circular SCAN)
C-SCAN moves the disk arm towards one end of
the disk, servicing requests, and then immediately
returns to the beginning 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.
Advantages :
Provides a more uniform wait time compared to
SCAN.
Reduces the likelihood of starvation compared to
SSTF.
Disadvantages :
Can be less efficient than SCAN due to the not
serviced return trip.
More complex to implement than FCFS and
SSTF
C-LOOK (Circular LOOK)
C-LOOK is similar to C-SCAN but only goes
as far as the last request in each direction
before reversing.

Advantages:
More efficient than C-SCAN as it avoids
unnecessary traversal.
Provides a uniform wait time similar to C-
SCAN.

Disadvantages :
Complex to implement.
May have slightly longer seek times than
SSTF for some requests.
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 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.
Thank You

19

You might also like