0% found this document useful (0 votes)
73 views

Disk Scheduling

The document discusses disk scheduling algorithms in operating systems. It describes the basic components of a disk including tracks and sectors. It then explains different scheduling algorithms like FCFS, SSTF, SCAN, C-SCAN, LOOK, and C-LOOK. For each algorithm, it provides details on how it works, advantages and disadvantages. It also provides examples to calculate number of disk head movements for sample request sequences using different algorithms.

Uploaded by

emiekanayake616
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)
73 views

Disk Scheduling

The document discusses disk scheduling algorithms in operating systems. It describes the basic components of a disk including tracks and sectors. It then explains different scheduling algorithms like FCFS, SSTF, SCAN, C-SCAN, LOOK, and C-LOOK. For each algorithm, it provides details on how it works, advantages and disadvantages. It also provides examples to calculate number of disk head movements for sample request sequences using different algorithms.

Uploaded by

emiekanayake616
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/ 15

Subject Name : Operating System

Course Name : BCA/B.Sc./Diploma(CS)


Prepared by: Hitesh Kansal
Disk Scheduling
Disk:
• A process needs two type of time, CPU time
and IO time. For I/O, it requests the
Operating system to access the disk.
• Each Disk has a flat circular shape like a CD
or DVD.
• Generally Diameter range from 1.8 to 5.25
inches.
• Surface of disk is divided into circular track,
tracks are further divided into sectors.
Seek Time: Time required to move the
read/write head on the desired track.

Disk Scheduling:
In case of multiple I/O request disk scheduling
algorithm must decide which request must be
executed first.
Disk Scheduling Algorithm:

❖ FCFS(First Come First Serve)


❖ SSTF(Shortest Seek Time First)
❖ SCAN
❖ C-SCAN(Circular Scan)
❖ LOOK
❖ C-LOOK(Circular Look)

FCFS(First Come First Serve):

➢First and simplest disk scheduling algorithm.


➢ Every request is serviced according to come
request.

Advantage:

o Easy to understand
o Easy to implement
o It can be used with less load of process

Disadvantage :

o Required more Seek time and Waiting Time.

Example :

Consider the following disk request


sequence for a disk with 90 tracks
12, 34, 52, 14,25,68,39
R/W head is starting at 53. Find the number of
movements using First Come First Serve
scheduling.

Answer:

No. of Move by the head:


(53-12)+(34-12)+(52-34)+(52-14 ) +
(25-14)+(68-25)+(68-39)

= 202(Move).
0 12 14 25 34 39 52 53 68 80 90
SSTF(Shortest Seek Time First)

➢Services the request which is closest to the


current position.
➢Tie is broken is the direction of head movement

Advantage:

o Very Efficient in seek move


o Less average response time and waiting
time.
o Increase Throughput.

Disadvantage :
o Overhead to find out the closet requirement
.
Example :

Consider the following disk request


sequence for a disk with 90 tracks
12, 34, 52, 14,25,68,39
R/W head is starting at 53. Find the number of
movements using SSTF scheduling.

Answer:

No. of Move by the head:


(53-52)+(52-39)+(39-34)+(34-25 ) +
(25-14)+(14-12)+(68-12)

=97(MOVES).

0 12 14 25 34 39 52 53 68 80 90
SCAN

➢ Head start at one end of the disk &


moves towards the other end.
➢ Some time is called elevator Algorithm
➢ The direction of the head is reversed and
process continues.
Advantage:

o Low variance and average waiting time.


o Simple easy to understand.

Disadvantage :
o Long waiting time for location just visited
by head.
Example :

Consider the following disk request


sequence for a disk with 90 tracks
12, 34, 52, 14,25,68,39
R/W head is starting at 53. Find the number of
movements using SSTF scheduling.

Answer:

No. of Move by the head:


(68-53)+(90-68)+(90-52)+(52-39) +
(39-34)+(34-25)+(25-14)+(14-12)

=115(MOVES).

0 12 14 25 34 39 52 53 68 80 90
C-SCAN

➢ Head start at one end of the disk &


moves towards the other end.
➢ The direction of the head is reversed and
Head reaches First end without satisfy
any request.
Advantage:

o Provide uniform waiting time.


o Better Response Time.

Disadvantage :
o More Risk ,compare to simple Scan
Algorithm
Example :

Consider the following disk request


sequence for a disk with 90 tracks
12, 34, 52, 14,25,68,39
R/W head is starting at 53. Find the number of
movements using SSTF scheduling.

Answer:

No. of Move by the head:


(68-53)+(90-68)+(90-0)+(12-0)+
(14-12)+(25-14)+(34-25)+(39-34)
+(52-39)

=179(MOVES).

0 12 14 25 34 39 52 53 68 80 90
LOOK

It is same as scan algorithm but instead of going


till last track we go till last request & then
change direction.

Advantage:
.
• Better performance compare to scan
algorithm

Disadvantage :

o Overhead to find the last request .


Example :

Consider the following disk request


sequence for a disk with 90 tracks
12, 34, 52, 14,25,68,39
R/W head is starting at 53. Find the number of
movements using SSTF scheduling.

Answer:

No. of Move by the head:


(68-53)+(68-52)+(52-39)+(39-34 ) +
(34-25)+(25-14)+(14-12)

=71(MOVES).
0 12 14 25 34 39 52 53 68 80 90

C-LOOK

➢ It takes the advantage of both C-Scan


and Look algorithm.
➢ We will satisfy request only in are
direction.
➢ We will go till last request & return but
not till last track.
Advantage:
.
• More uniform waiting time compare to
LOOK algorithm.

Disadvantage :

o More Overhead in calculate

Example :

Consider the following disk request


sequence for a disk with 90 tracks
12, 34, 52, 14,25,68,39
R/W head is starting at 53. Find the number of
movements using SSTF scheduling.

Answer:

No. of Move by the head:


(68-53)+(68-12)+(14-12)+(25-14)
+(34-25)+(39-34)+(52-39)
=111(MOVES).

0 12 14 25 34 39 52 53 68 80 90

0 12 14 25 34 39 52 53 68 80 90

You might also like