0% found this document useful (0 votes)
23 views35 pages

Disk scheduling Final

Disk scheduling class notes

Uploaded by

saitejag879
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)
23 views35 pages

Disk scheduling Final

Disk scheduling class notes

Uploaded by

saitejag879
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/ 35

Disk scheduling

• Disk scheduling is a technique operating


systems use to manage the order in which disk
I/O (input/output) requests are processed.
Disk scheduling is also known as I/O
Scheduling. The main goals of disk scheduling
are to optimize the performance of disk
operations, reduce the time it takes to access
data and improve overall system efficiency.
Disk scheduling
• Disk scheduling algorithms are crucial in managing
how data is read from and written to a computer’s
hard disk.
• These algorithms help determine the order in which
disk read and write requests are processed,
significantly impacting the speed and efficiency of
data access.
• Common disk scheduling methods include First-
Come First-Served (FCFS), Shortest Seek Time First
(SSTF), SCAN, C-SCAN, LOOK, and C-LOOK.
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 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.
3
Importance of Disk Scheduling
• Multiple I/O requests may arrive by different
processes and only one I/O request can be served
at a time by the disk controller. Thus other I/O
requests need to wait in the waiting queue and
need to be scheduled.
• Two or more requests may be far from each other
so this can result in greater disk arm movement.
• Hard drives are one of the slowest parts of the
computer system and thus need to be accessed in
an efficient manner.
Key Terms Associated with Disk Scheduling

• Seek Time: Seek time is the time taken to locate the disk arm to a
specified track where the data is to be read or written. So the disk
scheduling algorithm that gives a minimum average seek time is better.
• Rotational Latency: Rotational Latency is the time taken by the desired
sector of the disk to rotate into a position so that it can access the
read/write heads. So the disk scheduling algorithm that gives
minimum rotational latency is better.
• Transfer Time: Transfer time is the time to transfer the data. It
depends on the rotating speed of the disk and the number of bytes to
be transferred.
• Disk Access Time:
Disk Access Time = Seek Time + Rotational Latency + Transfer Time
• Total Seek Time = Total head Movement * Seek Time
•Disk Response Time: Response Time is the
average time spent by a request waiting to
perform its I/O operation. The
average Response time is the response time of
all requests. Variance Response Time is the
measure of how individual requests are
serviced with respect to average response
time. So the disk scheduling algorithm that
Goal of Disk Scheduling Algorithms

• Minimize Seek Time


• Maximize Throughput
• Minimize Latency
• Fairness
• Efficiency in Resource Utilization
Disk Scheduling Algorithms

• FCFS (First Come First Serve)


• SSTF (Shortest Seek Time First)
• SCAN
• C-SCAN
• LOOK
• C-LOOK
• LIFO (Last-In First-Out)
FCFS
• FCFS is the simplest of all Disk Scheduling
Algorithms.
• In FCFS, the requests are addressed in the
order they arrive in the disk queue.
• Let us understand this with the help of an
example.
Suppose the order of request is-
(82,170,43,140,24,16,190)
And current position of Read/Write head is: 50
• So, total overhead movement (total distance
covered by the disk arm) =
(82-50)+(170-82)+(170-43)+(140-43)+(140-24)+(24-
16)+(190-16) =642
Advantages of FCFS
• Every request gets a fair chance
• No indefinite postponement
• Disadvantages of FCFS

Disadvantages of First Come First Serve.

• Does not try to optimize seek time


• May not provide the best possible service
Shortest Seek Time First
• In SSTF (Shortest Seek Time First), requests having the
shortest seek time are executed first.
• So, the seek time of every request is calculated in
advance in the queue and then they are scheduled
according to their calculated seek time.
• As a result, the request near the disk arm will get
executed first.
• SSTF is certainly an improvement over FCFS as it
decreases the average response time and increases
the throughput of the system.
SSTF
• Selects the request with the minimum seek
time from 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.

14
SSTF (Cont.)

15
• Suppose the order of request is-
(82,170,43,140,24,16,190)
And current position of Read/Write head is: 50
• Total overhead movement (total distance
covered by the disk arm) =
(50-43)+(43-24)+(24-16)+(82-16)+(140-82) +(170-
140)+(190-170) =208
Advantages of Shortest Seek Time First

• The average Response Time decreases


• Throughput increases
• Disadvantages of Shortest Seek Time First

Disadvantages of Shortest Seek Time First

• Overhead to calculate seek time in advance


• Can cause Starvation for a request if it has a higher seek time as
compared to incoming requests
• The high variance of response time as SSTF favors only some requests
SCAN
• 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.
• Sometimes called the elevator algorithm.
• Illustration shows total head movement of 208
cylinders.

18
• In the SCAN algorithm the disk arm moves in a
particular direction and services the requests
coming in its path and after reaching the end of the
disk, it reverses its direction and again services the
request arriving in its path.
• So, this algorithm works as an elevator and is
hence also known as an elevator algorithm.
• As a result, the requests at the midrange are
serviced more and those arriving behind the disk
arm will have to wait.
SCAN
• 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”.

• Therefore, the total overhead movement


(total distance covered by the disk arm) is
calculated as
= (199-50) + (199-16) = 332
Advantages of SCAN Algorithm

• High throughput
• Low variance of response time
• Average response time
• Disadvantages of SCAN Algorithm

Disadvantages

• Long waiting time for requests for locations just visited by


disk arm
C-SCAN
• In the SCAN algorithm, the disk arm again scans the path
that has been scanned, after reversing its direction.
• So, it may be possible that too many requests are waiting
at the other end or there may be zero or few requests
pending at the scanned area.
• These situations are avoided in the CSCAN algorithm in
which the disk arm instead of reversing its direction goes
to the other end of the disk and starts servicing the
requests from there.
• So, the disk arm moves in a circular fashion and this
algorithm is also similar to the SCAN algorithm hence it is
known as C-SCAN (Circular SCAN).
23
C-SCAN
C-SCAN
• Suppose the requests 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”.

• So, the total overhead movement (total distance


covered by the disk arm) is calculated as:
=(199-50) + (199-0) + (43-0) = 391
Advantages of C-SCAN Algorithm
• Here are some of the advantages of C-SCAN.
• Provides more uniform wait time compared to
SCAN.
LOOK
• LOOK Algorithm is similar to the SCAN disk
scheduling algorithm except for the difference
that the disk arm in spite of going to the end
of the disk goes only to the last request to be
serviced in front of the head and then
reverses its direction from there only.
• Thus it prevents the extra delay which
occurred due to unnecessary traversal to the
end of the disk.
LOOK
• Suppose the requests 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”.

• So, the total overhead movement (total distance


covered by the disk arm) is calculated as:

= (190-50) + (190-16) = 314


C-LOOK
• As LOOK is similar to the SCAN algorithm, in a
similar way, C-LOOK is similar to the CSCAN disk
scheduling algorithm.
• In CLOOK, the disk arm in spite of going to the end
goes only to the last request to be serviced in front
of the head and then from there goes to the other
end’s last request.
• Thus, it also prevents the extra delay which
occurred due to unnecessary traversal to the end
of the disk.
30
• So, the total overhead movement (total
distance covered by the disk arm) is calculated
as

= (190-50) + (190-16) + (43-16) = 341


LIFO (Last-In First-Out)
• In LIFO (Last In, First Out) algorithm, the
newest jobs are serviced before the existing
ones i.e. in order of requests that get serviced
the job that is newest or last entered is
serviced first, and then the rest in the same
order.
Advantages of LIFO (Last-In First-Out)

• Maximizes locality and resource utilization


• Can seem a little unfair to other requests and
if new requests keep coming in, it cause
starvation to the old and existing ones.
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.

35

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy