Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE) PDF Download

Introduction

Disk scheduling is done by operating systems to schedule I/O requests arriving for the disk. Disk scheduling is also known as I/O scheduling.

Disk scheduling is important because:

  • 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 request may be far from each other so 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.

There are many Disk Scheduling Algorithms but before discussing them let’s have a quick look at some of the important terms:

  • 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 write. So the disk scheduling algorithm that gives minimum average seek time is better.
  • Rotational Latency: Rotational Latency is the time taken by the desired sector of 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 number of bytes to be transferred.
  • Disk Access Time: Disk Access Time is:
    Disk Access Time = Seek Time + Rotational Latency + Transfer Time
    Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)
  • Disk Response Time: Response Time is the average of time spent by a request waiting to perform its I/O operation. Average Response time is the response time of the all requests. Variance Response Time is measure of how individual request are serviced 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 requests are addressed in the order they arrive in the disk queue. Let us understand this with the help of an example.
Example:
Suppose the order of request is- (82,170,43,140,24,16,190)
And current position of Read/Write head is: 50
Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)So, total seek time:
= (82 - 50) + (170 - 82) + (170 - 43) + (140 - 43) + (140 - 24) + (24 - 16) + (190 - 16) = 642
Advantages:

  • Every request gets a fair chance
  • No indefinite postponement

Disadvantages:

  • Does not try to optimize seek time
  • May not provide the best possible service

2. SSTF: In SSTF (Shortest Seek Time First), requests having 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 system. Let us understand this with the help of an example.
Example:
Suppose the order of request is- (82, 170, 43, 140, 24, 16, 190)
And current position of Read/Write head is: 50
Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

So, total seek time:
= (50 - 43) + (43 - 24) + (24 - 16) + (82 - 16) + (140 - 82) + (170 - 40) + (190 - 170) = 208
Advantages:

  • Average Response Time decreases
  • Throughput increases

Disadvantages:

  • Overhead to calculate seek time in advance
  • Can cause Starvation for a request if it has higher seek time as compared to incoming requests
  • High variance of response time as SSTF favours only some requests

3. SCAN: In SCAN algorithm the disk arm moves into a particular direction and services the requests coming in its path and after reaching the end of disk, it reverses its direction and again services the request arriving in its path. So, this algorithm works as an elevator and hence also known as elevator algorithm. As a result, the requests at the midrange are serviced more and those arriving behind the disk arm will have to wait.
Example:
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”.
Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

Therefore, the seek time is calculated as:
= (199 - 50) + (199 - 16) = 332
Advantages:

  • High throughput
  • Low variance of response time
  • Average response time

Disadvantages:

  • Long waiting time for requests for locations just visited by disk arm

4. CSCAN: In 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 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 SCAN algorithm and hence it is known as C-SCAN (Circular SCAN).
Example:
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”.
Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

Seek time is calculated as:
= (199 - 50) + (199 - 0) + (43 - 0) = 391
Advantages:

  • Provides more uniform wait time compared to SCAN

5. LOOK: It 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.
Example:
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”.
Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

So, the seek time is calculated as:
= (190 - 50) + (190 - 16) = 314
6. CLOOK: As 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 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.
Example:
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”.
Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

So, the seek time is calculated as:
= (190 - 50) + (190 - 16) + (43 - 16) = 341
7. RSS: It stands for random scheduling and just like its name it is nature. It is used in situations where scheduling involves random attributes such as random processing time, random due dates, random weights, and stochastic machine breakdowns this algorithm sits perfect. Which is why it is usually used for and analysis and simulation.
8. LIFO: In LIFO (Last In, First Out) algorithm, 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

  • Maximizes locality and resource utilization

Disadvantages

  • Can seem a little unfair to other requests and if new requests keep coming in, it cause starvation to the old and existing ones.

Example
Suppose the order of request is- (82, 170, 43, 142, 24, 16, 190)
And current position of Read/Write head is: 50

Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

9. N-STEP SCAN: It is also known as N-STEP LOOK algorithm. In this a buffer is created for N requests. All requests belonging to a buffer will be serviced in one go. Also once the buffer is full no new requests are kept in this buffer and are sent to another one. Now, when these N requests are serviced, the time comes for another top N requests and this way all get requests get a guaranteed service
Advantages:

  • It eliminates starvation of requests completely

10. FSCAN: This algorithm uses two sub-queues. During the scan all requests in the first queue are serviced and the new incoming requests are added to the second queue. All new requests are kept on halt until the existing requests in the first queue are serviced.
Advantages:

  • FSCAN along with N-Step-SCAN prevents “arm stickiness” (phenomena in I/O scheduling where the scheduling algorithm continues to service requests at or near the current sector and thus prevents any seeking)

Each algorithm is unique in its own way. Overall Performance depends on the number and type of requests.

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

The document Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE) is a part of the Computer Science Engineering (CSE) Course Operating System.
All you need of Computer Science Engineering (CSE) at this link: Computer Science Engineering (CSE)
10 videos|99 docs|33 tests

Top Courses for Computer Science Engineering (CSE)

FAQs on Disk Scheduling Algorithms - Operating System - Computer Science Engineering (CSE)

1. What is disk scheduling in computer science engineering?
Ans. Disk scheduling is a technique used in computer science engineering to determine the order in which pending input/output (I/O) requests to a disk are executed. It aims to optimize the disk's performance and minimize the access time for these requests.
2. What are disk scheduling algorithms?
Ans. Disk scheduling algorithms are a set of techniques used to decide the order in which the pending I/O requests are serviced by the disk. These algorithms take into consideration factors such as seek time, rotational latency, and transfer time to optimize the disk's performance.
3. What is the seek time in disk scheduling?
Ans. Seek time in disk scheduling refers to the time taken by the disk's read/write head to move from its current position to the track where the requested data is located. Minimizing seek time is crucial in disk scheduling algorithms to improve overall performance.
4. What are some commonly used disk scheduling algorithms?
Ans. Some commonly used disk scheduling algorithms are: - FCFS (First-Come-First-Serve): Processes the I/O requests in the order they arrive. - SSTF (Shortest Seek Time First): Services the request with the shortest seek time first. - SCAN: Moves the read/write head in one direction, servicing requests along the way, and then reverses direction. - C-SCAN (Circular SCAN): Similar to SCAN, but the read/write head moves only in one direction and jumps to the other end when reaching the end. - LOOK: Similar to SCAN, but the read/write head reverses direction without reaching the end of the disk.
5. How do disk scheduling algorithms impact the disk's performance?
Ans. Disk scheduling algorithms can significantly impact the disk's performance by minimizing seek time, reducing rotational latency, and optimizing transfer time. By intelligently ordering the I/O requests, these algorithms can improve the overall efficiency of data retrieval from the disk, leading to faster response times and enhanced system performance.
10 videos|99 docs|33 tests
Download as PDF
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev
Related Searches

pdf

,

practice quizzes

,

Exam

,

past year papers

,

Viva Questions

,

MCQs

,

mock tests for examination

,

Summary

,

Important questions

,

Objective type Questions

,

ppt

,

Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

,

Sample Paper

,

study material

,

Semester Notes

,

video lectures

,

Previous Year Questions with Solutions

,

Extra Questions

,

shortcuts and tricks

,

Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

,

Disk Scheduling Algorithms | Operating System - Computer Science Engineering (CSE)

,

Free

;