0% found this document useful (0 votes)
164 views7 pages

Disk Scheduling OS

The document discusses disk scheduling algorithms used by operating systems to efficiently schedule I/O requests arriving for the disk. It explains that disk scheduling is important to minimize seek time, rotational latency, and average response time. It then describes the First Come First Served (FCFS), Shortest Seek Time First (SSTF), and SCAN disk scheduling algorithms through examples. FCFS is the simplest but does not optimize seek time. SSTF aims to minimize seek time but can cause starvation. SCAN services requests in the direction of disk arm movement like an elevator.

Uploaded by

Suraj Khan
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)
164 views7 pages

Disk Scheduling OS

The document discusses disk scheduling algorithms used by operating systems to efficiently schedule I/O requests arriving for the disk. It explains that disk scheduling is important to minimize seek time, rotational latency, and average response time. It then describes the First Come First Served (FCFS), Shortest Seek Time First (SSTF), and SCAN disk scheduling algorithms through examples. FCFS is the simplest but does not optimize seek time. SSTF aims to minimize seek time but can cause starvation. SCAN services requests in the direction of disk arm movement like an elevator.

Uploaded by

Suraj Khan
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/ 7

Courses Tutorials Jobs Practice Contests Sign In

Data Structures Algorithms Interview Preparation Topic-wise Practice C++ Java Python SDE Hiring Challenge Competitive Programming Machine Learning Write & Earn

Write an Article

Data Structures &


Write an Interview Experience Algorithms- Self Paced

Basics
Disk Scheduling Algorithms Course
View Details
Difficulty Level :
Easy ● Last Updated :
24 Feb, 2022
Process & Threads

Read Discuss
CPU Scheduling

Process Synchronization
 

Disk scheduling is done by operating systems to schedule I/O request s arriving for the

Deadlock
disk. Disk scheduling is also known as I/O scheduling. 

Memory Management Disk scheduling is impor tant because: 

Disk Management
Multiple I/O request s may arrive by dif ferent processes and only one I/O request can

be ser ved at a time by the disk controller. Thus other I/O request s need to wait in the
Disk Scheduling
waiting queue and need to be scheduled.

Two or more request may be far from each other so can result in greater disk arm
Disk Scheduling Algorithms
movement.

Program for SSTF disk Hard drives are one of the slowest par t s of the computer system and thus need to be

scheduling algorithm accessed in an ef ficient manner.

SCAN (Elevator) Disk Scheduling There are many Disk Scheduling Algorithms but before discussing them let ’s have a quick
Algorithms
look at some of the impor tant terms: 

C-SCAN Disk Scheduling  

Algorithm
Seek Time:Seek time is the time taken to locate the disk arm to a specified track where

LOOK Disk Scheduling Algorithm the data is to be read or write. So the disk scheduling algorithm that gives minimum

average seek time is better.

C-LOOK Disk Scheduling Rotational L atency: Rotational L atency is the time taken by the desired sector of disk

Algorithm
to rotate into a position so that it can access the read/write heads. So the disk

N-Step-SCAN disk scheduling


scheduling algorithm that gives minimum rotational latency is better.

Transfer Time : Transfer time is the time to transfer the data. It depends on the

FScan disk scheduling algorithm rotating speed of the disk and number of bytes to be transferred.

Disk Access Time : Disk Access Time is:

Operating System Quizes


 

Operating System GATE


Questions WHAT'S NEW

Master CS Subjects For SDE


Preparation

View Details

Complete Interview
Preparation- Self Paced
Course
View Details

Disk Access Time = Seek Time +

Rotational Latency +

Transfer Time

Skip to content
Start Your Coding Journey Now! Login Register

Disk Response Time : Response Time is the average of time spent by a request waiting

to per form it s I/O operation. Average Response time is the response time of the all

request s. Variance Response Time is measure of how individual request are ser viced

with respect to average response time. So the disk scheduling algorithm that gives

minimum variance response time is better.

Disk Scheduling Algorithms 

1. FCFS: FCFS is the simplest of all the Disk Scheduling Algorithms. In FCFS, the

request s are addressed in the order they arrive in the disk queue.Let us understand

this with the help of an example.

Example :

1. Suppose the order of request is- (82,170,43,140,24,16,190)

And current position of Read/ Write head is : 50 

1. So, total seek time: 

=(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-16)+(190-16) 

=642 

Advantages: 

Ever y request get s a fair chance

No indefinite postponement

Disadvantages: 

Does not tr y to optimize seek time

May not provide the best possible ser vice

Skip to content
Start Your Coding Journey Now!
1. S S TF: In S STF (Shor test Seek Time First), request s having shor test seek time are

Login Register
executed first. So, the seek time of ever y request is calculated in advance in the queue

and then they are scheduled according to their calculated seek time. A s a result, the

request near the disk arm will get executed first. S STF is cer tainly an improvement

over FCFS as it decreases the average response time and increases the throughput of

system.Let us understand this with the help of an example.

Example :

1. Suppose the order of request is- (82,170,43,140,24,16,190)

And current position of Read/ Write head is : 50 

1.  

So, total seek time:

1. =(50-43)+(43-24)+(24-16)+(82-16)+(140-82)+(170-140)+(190-170) 

=208

Advantages: 

Average Response Time decreases

Throughput increases

Disadvantages: 

Overhead to calculate seek time in advance

Can cause Star vation for a request if it has higher seek time as compared to incoming

request s

High variance of response time as S STF favours only some request s

1. SCAN: In SCAN algorithm the disk arm moves into a par ticular direction and ser vices

the request s coming in it s path and af ter reaching the end of disk, it reverses it s

direction and again ser vices the request arriving in it s path. So, this algorithm work s

as an elevator and hence also known as elevator algorithm. A s a result, the request s

at the midrange are ser viced more and those arriving behind the disk arm will have to

wait.

Example :

1. Suppose the request s to be addressed are-82,170,43,140,24,16,190. And the

Read/ Write arm is at 50, and it is also given that the disk arm should move “towards

the larger value”. 

Skip to content
Start Your Coding Journey Now! Login Register

1.  

Therefore, the seek time is calculated as:

1. =(199-50)+(199-16) 

=332

Advantages: 

High throughput

Low variance of response time

Average response time

Disadvantages: 

Long waiting time for request s for locations just visited by disk arm

1. C SCAN: In SCAN algorithm, the disk arm again scans the path that has been scanned,

af ter reversing it s direction. So, it may be possible that too many request s are waiting

at the other end or there may be zero or few request s pending at the scanned area.

These situations are avoided in CSCAN algorithm in which the disk arm instead of

reversing it s direction goes to the other end of the disk and star t s ser vicing the request s

from there. So, the disk arm moves in a circular fashion and this algorithm is also similar

to SCAN algorithm and hence it is known as C-SCAN (Circular SCAN). 

Example :

Suppose the request s to be addressed are-82,170,43,140,24,16,190. And the Read/ Write

arm is at 50, and it is also given that the disk arm should move “towards the larger

value”. 

Seek time is calculated as:

Skip to content
Start Your Coding Journey Now!
=(199-50)+(199-0)+(43-0) 

Login Register
=391 

Advantages: 

Provides more uniform wait time compared to SCAN

1. LOOK: It is similar to the SCAN disk scheduling algorithm except for the dif ference that

the disk arm in spite of going to the end of the disk goes only to the last request to be

ser viced in front of the head and then reverses it s direction from there only. Thus it

prevent s the extra delay which occurred due to unnecessar y traversal to the end of the

disk.

Example :

1. Suppose the request s to be addressed are-82,170,43,140,24,16,190. And the

Read/ Write arm is at 50, and it is also given that the disk arm should move “towards

the larger value”. 

1.  

So, the seek time is calculated as:

1. =(190-50)+(190-16) 

=314

1. CLOOK: A s LOOK is similar to SCAN algorithm, in similar way, CLOOK is similar to

CSCAN disk scheduling algorithm. In CLOOK, the disk arm in spite of going to the end

goes only to the last request to be ser viced in front of the head and then from there

goes to the other end’s last request. Thus, it also prevent s the extra delay which

occurred due to unnecessar y traversal to the end of the disk.

Example :

1. Suppose the request s to be addressed are-82,170,43,140,24,16,190. And the

Read/ Write arm is at 50, and it is also given that the disk arm should move “towards

the larger value” 

Skip to content
Start Your Coding Journey Now! Login Register

1.  

So, the seek time is calculated as:

1. =(190-50)+(190-16)+(43-16) 

=341

2. RS S– It stands for random scheduling and just like it s name it is nature. It is used in

situations where scheduling involves random attributes such as random processing

time, random due dates, random weight s, and stochastic machine breakdowns this

algorithm sit s per fect. Which is why it is usually used for and analysis and simulation.

3. LIFO– In LIFO (L ast In, First Out) algorithm, newest jobs are ser viced before the

existing ones i.e. in order of request s that get ser viced the job that is newest or last

entered is ser viced first and then the rest in the same order. 

Advantages 

Maximizes localit y and resource utilization

Can seem a little unfair to other request s and if new request s keep coming in, it

cause star vation to the old and existing ones.

4. N-S TEP SCAN – It is also known as N-STEP LOOK algorithm. In this a buf fer is created

for N request s. All request s belonging to a buf fer will be ser viced in one go. Also once

the buf fer is full no new request s are kept in this buf fer and are sent to another one.

Now, when these N request s are ser viced, the time comes for another top N request s

and this way all get request s get a guaranteed ser vice 

Advantages 

It eliminates star vation of request s completely

5. FSCAN– This algorithm uses two sub-queues. During the scan all request s in the first

queue are ser viced and the new incoming request s are added to the second queue. All

new request s are kept on halt until the existing request s in the first queue are

ser viced. 

Advantages 

FSCAN along with N-Step-SCAN prevent s “arm stickiness” (phenomena in I/O

scheduling where the scheduling algorithm continues to ser vice request s at or

near the current sector and thus prevent s any seeking)

Each algorithm is unique in it s own way. Overall Per formance depends on the number

and t ype of request s. 

Note :Average Rotational latency is generally taken as 1/2(Rotational latency). 

Exercise 

1) Suppose a disk has 201 cylinders, numbered from 0 to 200. At some time the disk arm is

at cylinder 100, and there is a queue of disk access request s for cylinders 30, 85, 90, 100,

105, 110, 135 and 145. If Shor test-Seek Time First (S STF) is being used for scheduling the

disk access, the request for cylinder 90 is ser viced af ter ser vicing ____________ number of

request s. (GATE CS 2014 

(A) 1 

(B) 2 

(C) 3 

(D) 4 

See this for solution. 

2) Consider an operating system capable of loading and executing a single sequential

user process at a time. The disk head scheduling algorithm used is First Come First

Ser ved (FCFS). If FCFS is replaced by Shor test Seek Time First (S STF), claimed by the

Skip to content
vendor to give 50% better benchmark result s, what is the expected improvement in the
Start Your Coding Journey Now!
I/O per formance of user programs? (GATE CS 2004) 

Login Register
(A) 50% 

(B) 40% 

(C) 25% 

(D) 0% 

See this for solution. 

3) Suppose the following disk request sequence (track numbers) for a disk with 100

track s is given: 45, 20, 90, 10, 50, 60, 80, 25, 70. A ssume that the initial position of the

R/ W head is on track 50. The additional distance that will be traversed by the R/ W head

when the Shor test Seek Time First (S STF) algorithm is used compared to the SCAN

(Elevator) algorithm (assuming that SCAN algorithm moves towards 100 when it star t s

execution) is _________ track s 

(A) 8 

(B) 9 

(C) 10 

(D) 11 

See this for solution. 

4) Consider a t ypical disk that rotates at 15000 rotations per minute (RPM) and has a

transfer rate of 50 × 10^6 bytes/sec. If the average seek time of the disk is twice the

average rotational delay and the controller ’s transfer time is 10 times the disk transfer

time, the average time (in milliseconds) to read or write a 512 byte sector of the disk is

_____________ 

See this for solution. 

This ar ticle is contributed by Ankit Mittal. Please write comment s if you find anything

incorrect, or you want to share more information about the topic discussed above.

Like 90

Previous Next

Free space management in Program for SSTF disk


Operating System scheduling algorithm

RECOMMENDED ARTICLES Page : 1 2 3

Difference between Seek Time FCFS Disk Scheduling


01 05
and Disk Access Time in Disk Algorithms
Scheduling 29, Jul 19

01, Apr 20

Difference between SCAN and


06
Difference between Transfer LOOK Disk scheduling
02
Time and Disk Access Time in algorithms
Disk Scheduling 03, Apr 20

27, Apr 20

Difference between FCFS and


07
Difference between Rotational SCAN disk scheduling
03
Latency and Disk Access Time algorithms
in Disk Scheduling 06, Apr 20

08, Jun 20

Difference between SCAN and


08
SCAN (Elevator) Disk CSCAN Disk scheduling
04
Scheduling Algorithms algorithms
29, Jul 19 14, Apr 20

Skip to content

You might also like