The Wayback Machine - https://web.archive.org/web/20240917154333/https://www.geeksforgeeks.org/difference-between-sstf-and-c-look-disk-scheduling-algorithm/
Open In App

Difference Between SSTF and C-LOOK Disk Scheduling Algorithm

Last Updated : 22 Feb, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

The secondary storage scheduling algorithm known as SSTF decides how the disk’s head and arm will move in response to read and write requests while in C-SCAN the head services request only in one direction(either left or right) until all the requests in this direction are not serviced and then jumps back to the farthest request in the other direction and services the remaining requests which gives a better uniform servicing as well as avoids wasting seek time for going till the end of the disk. You will discover the distinction between the SSTF and C-LOOK disk scheduling algorithms in this post. However, you must first understand the distinctions between the SSTF and C-LOOK disk scheduling algorithms.

SSTF Disk Scheduling Algorithm

SSTF stands for Shortest Seek Time First. As the name specifies, this algorithm serves the task request that is closest to the current position of the head or pointer. Here, the direction of the head plays a vital role in determining total head movement. If there occurs a tie between requests then the head will serve the request which encounters it, in its ongoing direction. Unlike C-LOOK, the SSTF algorithm is very efficient in total seek time.

Example – Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows:

98, 183, 40, 122, 10, 124, 65

The current head position of the Read\Write head is 53 and will move in the right direction. Calculate the total number of track movements of the Read/Write head using the SSTF algorithm.

SSTF

Total head movements = (65-53)+(65-40)+(40-10)+(98-10)+(122-98)+(124-122)+(183-124) = 240

Algorithm of SSTF

  • Step 1: Let an array containing the indexes of the requested tracks be represented by the Request array. “head” refers to the disk head’s location.
  • Step 2: Determine each track’s positive separation from the head in the request array.
  • Step 3: Select a track with a minimal distance from the head from the specified array that hasn’t been accessed or serviced yet.
  • Step 4: Using this distance, increase the total number of seeks.
  • Step 5: The head position is now the currently serviced track position.
  • Step 6: Repeat step 2 up until the request array’s last track is unserviced.

Advantages of SSTF

  • It gets better and boosts throughput.
  • The total search time of SSTF is less than that of FCFS.
  • Both the average waiting time and response time are lower.

Disadvantages of SSTF

  • Requests that are made distant from the head may result in starvation.
  • Response and waiting times have a large degree of variety in the SSTF disk scheduling technique.
  • Frequent direction changes of the head slow down the algorithm.

C-LOOK Disk Scheduling Algorithm

An improved variant of the SCAN and LOOK disk scheduling methods is the C-LOOK disk scheduling algorithm. The search time of this technique is faster than that of the C-SCAN algorithm, but it still uses the same concept of wrapping the tracks into a circular cylinder. As with C-SCAN, which we know is utilised to prevent starvation and provide more uniform service to all requests, C-LOOK does the same. In this algorithm, the head starts from first request in one direction and moves towards the last request at other end, serving all request in between. After reaching last request in one end, the head jumps in other direction and move towards the remaining requests and then satisfies them in same direction as before. Unlike SSTF, it doesn’t serves the task request which is closest to the current position of head or pointer.

Example –

Consider a disk with 200 tracks (0-199) and the disk queue having I/O requests in the following order as follows :

98, 183, 40, 122, 10, 124, 65

The current head position of the Read/Write head is 53 and will move in Right direction . Calculate the total number of track movements of Read/Write head using C-LOOK algorithm.

C-LOOK

Total head movements  = (65-53)+(98-65)+(122-98)
+(124-122)+(183-124)+(183-10)+(40-10)
= 333

Algorithm of C-LOOK

  • Step 1: Assume that the head is the location of the disk head and that the Request array is an array that stores the indexes of the songs that have been requested in ascending order of arrival time.
  • Step 2: The head moves in the same way as it did initially, and it continues in that direction.
  • Step 3: The head responds to each request individually as it moves in that direction.
  • Step 4: Until all requests in this direction have been fulfilled, the head keeps moving in the same direction.
  • Step 5: Determine the exact separation between the tracks and the head while proceeding in this manner.
  • Step 6: Using this distance, increase the total number of seeks.
  • Step 7: The head position is now the currently serviced track position.
  • Step 8: Repeat steps 5 through 8 until the final request is made in this manner.
  • Step 9: Should we reach the final request in the current direction, we will turn around and move the head in that direction until we reach the final request that must be fulfilled in this direction, skipping the requests that come before it.
  • Step 10: Change course and return to step 3 until no inquiries remain unanswered.

Advantages of C-LOOk

  • Determine the disk head’s starting location.
  • Arrange the disk requests that are still outstanding in the order that they will be addressed.
  • As requests come in, handle them by scanning the disk in the selected direction.
  • Return to the beginning of the disk and resume the operation as soon as the final request in the current direction has been fulfilled.

Disadvantages of C-LOOK

  • When a lot of data needs to be read or written in one route, it might not be the best option because a lot of requests might get queued up in the other direction.
  • It does not prioritise requests according to their urgency or relevance, therefore it might not be appropriate for real-time systems where quick response times are essential.
  • Requests that are positioned far from the disk head’s current position may become starved as a result.

Difference Between SSTF and C-LOOK

SSTF DISK SCHEDULING ALGORITHM C-LOOK DISK SCHEDULING ALGORITHM
SSTF algorithm can manipulate the requests in both directions. Whereas, C-LOOK algorithm services the requests only in one direction.
In SSTF algorithm there is an burden of finding closest request. Here, this algorithm causes more seek time as compared to SSTF.
SSTF algorithm lags in performance. But, the performance of C-LOOK is far better than SSTF.
In above example of SSTF algorithm, the head starts from 53 and analyse the request which is closest to it and hence moves in that direction. In above example of C-LOOK algorithm, the head moves from 53, serves all requests in right direction till it reaches the last request in one end. Then it jumps to the remaining requests and serve them in right direction only.
SSTF algorithm can leads to starvation. C-LOOK algorithm will never cause starvation to any requests.
SSTF provides high variance in average waiting time and response time. Whereas C-LOOK algorithm provides low variance in average waiting time and response time.

Frequently Asked Question on SSTF and C-LOOK – FAQs

Which Disk Scheduling Algorithm has the best performance over all other Disk Scheduling Algorithms?

C-Look Disk Scheduling Algorithm has the best performance over all other Disk Scheduling Algorithms.

Why is SSTF not optimal?

There could be a risk of famine in SSTF. The SSTF algorithm is not the best one. Because we must determine the seek time in advance using this approach, there is a possibility of overhead in SSTF disk scheduling.Advantages

Is SSTF preemptive?

Because it is a non-preemptive CPU scheduling algorithm, once a process is assigned to a CPU, the CPU won’t be released until the process has finished running.

Can disk scheduling suffer from starvation due to the SSTF algorithm?

Finding the closest request has an overhead in the SSTF disk scheduling method. There is an overhead for locating end requests in this approach. The request that is farthest from the head in the SSTF disk scheduling algorithm will starve.



Similar Reads

Difference between SSTF and LOOK disk scheduling algorithm
1. SSTF disk scheduling algorithm : SSTF stands for Shortest Seek Time First. As the name specify, this algorithm serves the task request which is closest to current position of head or pointer. Here, the direction of head plays an vital role in determining total head movement. If there occurs a tie between requests then the head will serve the req
3 min read
Difference between LOOK and C-LOOK Disk scheduling algorithms
1. LOOK disk scheduling algorithm : Look Algorithm is actually an improves version of SCAN Algorithm. In this algorithm, the head starts from first request at one side of disk and moves towards the other end by serving all requests in between. After reaching the last request of one end, the head reverse its direction and returns to first request, s
3 min read
Difference between FCFS and SSTF Disk Scheduling Algorithm
Prerequisite - Disk Scheduling Algorithms 1. FCFS Disk Scheduling Algorithm : First come first serve, as name suggest this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this the head or pointer moves in the direction in which the task arrives and mo
3 min read
Difference Between C-SCAN and SSTF Disk Scheduling Algorithm
In C-SCAN Algorithm it is necessary to take into account the direction, i.e., larger or smaller value. This algorithm serves disk requests by moving towards their conclusion while SSTF is a secondary storage scheduling method that decides how the disk's head and arm will move to fulfil read and write requests. In this article, you will discover the
5 min read
Program for SSTF Disk Scheduling Algorithm
Given an array of disk track numbers and initial head position, our task is to find the total number of seek operations done to access all the requested tracks if Shortest Seek Time First (SSTF) is a disk scheduling algorithm is used. The basic idea is the tracks that are closer to the current disk head position should be serviced first in order to
10 min read
Difference between FCFS and C-LOOK disk scheduling algorithm
1. FCFS Disk Scheduling Algorithm FCFS stands for First Come First Serve, this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this, the head or pointer moves in the direction in which the task arrives and moves till all request is served. However, th
3 min read
Difference between C-LOOK and C-SCAN Disk Scheduling Algorithm
C-LOOK Disk Scheduling Algorithm C-LOOK is the modified version of both LOOK and C-scan algorithms. In this algorithm, the head starts from the first request in one direction and moves towards the last request at another end, serving all request in between. After reaching the last request in one end, the head jumps in another direction and move tow
3 min read
LOOK Disk Scheduling Algorithm
The LOOK Disk Scheduling Algorithm is the advanced version of the SCAN (elevator) disk scheduling algorithm which gives slightly better seek time than any other algorithm in the hierarchy (FCFS->SRTF->SCAN->C-SCAN->LOOK). It is used to reduce the amount of time it takes to access data on a hard disk drive by minimizing the seek time bet
13 min read
Difference between SCAN and LOOK Disk scheduling algorithms
SCAN disk scheduling algorithm: In SCAN disk scheduling algorithm, head starts from one end of the disk and moves towards the other end, servicing requests in between one by one and reach the other end. Then the direction of the head is reversed and the process continues as head continuously scan back and forth to access the disk. So, this algorith
4 min read
Difference between Seek Time and Disk Access Time in Disk Scheduling
Seek Time: A disk is divided into many circular tracks. Seek Time is defined as the time required by the read/write head to move from one track to another. Example, Consider the following diagram, the read/write head is currently on track 1. Now, on the next read/write request, we may want to read data from Track 4, in this case, our read/write hea
3 min read
Difference between Transfer Time and Disk Access Time in Disk Scheduling
1. Transfer Time : Time required to transfer the required amount of data. It can be calculated by the given formula Transfer time, = Data to be transfer / transfer rate Data to be transfer is given in the question and transfer rate is sometimes given and sometimes it may not be given. It can be calculated by the given formula. Transfer Rate, = {(Nu
2 min read
Difference between Rotational Latency and Disk Access Time in Disk Scheduling
1. Rotational Latency : Rotational Latency is also known as Rotational time. The amount of time taken by the disk to rotate the track when the read/write head come to exact sector or we can also say that the time taken by the desired sector to come under the read/write head is called rotational latency. Rotational Latency is depends on the rotation
4 min read
Difference between FCFS and C-SCAN disk scheduling algorithm
1. FCFS Disk Scheduling Algorithm : FCFS stands for First come first serve, this algorithm entertains the task in the order they arrived in the disk queue. It is the simplest and easy to understand disk scheduling algorithm. In this the head or pointer moves in the direction in which the task arrives and moves till all request is served. However, F
3 min read
Difference between Magnetic Disk and Optical Disk
The magnetic and optical disks are the storage devices that provide a way to store data for a long duration. Both are categorized as secondary storage devices. In this article, we are going to discuss the Difference between Magnetic Disks and Optical disks in detail. What is a Magnetic Disk?A magnetic disk is a storage device that uses a magnetizat
4 min read
Difference between Hard Disk and Floppy Disk
In computer two prominent types of storage devices that have been widely used are hard disk and floppy disk. A hard disk is a high-capacity, durable storage device that uses magnetic disks to store data, offering faster access and larger storage compared to a floppy disk, Where as Floppy disks are portable, low-capacity storage devices that were po
5 min read
Difference Between Basic Disk and Dynamic Disk
When managing storage in Windows operating systems, you might come across two primary kinds of disk configurations: Basic Disk and Dynamic Disk. To do this well and make sure that your data is organized according to your needs, it becomes important to know the differentiation between these disk types. This article will explore the main features and
6 min read
FScan disk scheduling algorithm
Fixed period SCAN (FSCAN) disk scheduling algorithm mainly focuses on handling high variance in shortest seek time first (SSTF). SCAN algorithm is also proposed to handle above mentioned situation but using SCAN algorithm causes long delay while handling requests which are at extremes of disk. FSCAN algorithm determines how read and write head of d
3 min read
C-SCAN Disk Scheduling Algorithm
Given an array of disk track numbers and initial head position, our task is to find the total number of seek operations to access all the requested tracks if a C-SCAN Disk Scheduling algorithm is used. The Circular SCAN (C-SCAN) Scheduling Algorithm is a modified version of the SCAN Disk Scheduling Algorithm that deals with the inefficiency of the
12 min read
Difference between Seek Time and Rotational Latency in Disk Scheduling
Seek Time: A disk is divided into many circular tracks. Seek Time is defined as the time required by the read/write head to move from one track to another. Example, Consider the following diagram, the read/write head is currently on track 1. Now, on the next read/write request, we may want to read data from Track 4, in this case, our read/write hea
2 min read
Difference between FCFS and SCAN disk scheduling algorithms
FCFS disk scheduling algorithm: As the name suggests, the FCFS Scheduling Algorithm processes requests in the sequential order in which they arrive in the disk queue. Even if a higher priority request arrives in the schedule later, FCFS will process the request in the order that they have arrived and hence we can say that FCFS has a fair policy. Ex
3 min read
Difference between Rotational Latency and Transfer Time in Disk Scheduling
1. Rotational Latency: Rotational Latency is the amount of time it takes for the desired sector of a to rotate under the read-write heads of the disk drive. In other words, the disk is divided into many circular tracks, and these tracks are further divided into blocks knows as sectors. So Rotational Latency is the time required by the read/write he
2 min read
Difference between SCAN and CSCAN Disk scheduling algorithms
Prerequisite - Disk Scheduling Algorithms 1. SCAN Disk Scheduling Algorithm : SCAN Disk Scheduling Algorithm is also known as Elevator algorithm. In this, head or pointer can move in both the direction i.e., disk arm starts to move from one end of the disk to the other end servicing all the requests until it reaches to the other end of the disk. Af
3 min read
Difference Between Seek Time and Transfer Time in Disk Scheduling
The head's seek time is the time it takes to move from the current track to the one containing the data. The amount of time needed to move data from the disc to the host system is called the transfer time. In hard drives, a head is present which is supposed to write or read from the magnetic disk. In this article we are going to discuss what are se
4 min read
Difference between Priority Scheduling and Round Robin (RR) CPU scheduling
1. Priority Scheduling Algorithm : Priority scheduling algorithm executes the processes depending upon their priority. Each process is allocated a priority and the process with the highest priority is executed first. Priorities can be defined internally as well as externally. Internal priorities are decided by the system depending upon the number o
3 min read
Difference between Priority scheduling and Shortest Job First (SJF) CPU scheduling
1. Priority Scheduling Algorithm : Priority scheduling algorithm executes the processes depending upon their priority. Each process is allocated a priority and the process with the highest priority is executed first. Priorities can be defined internally as well as externally. Internal priorities are decided by the system depending upon the number o
3 min read
Difference between Multi Level Queue Scheduling (MLQ) and Priority Scheduling
1. Multi Level Queue Scheduling (MLQ) : It is quite difficult to have just one queue and schedule all processes. This is where multi-level queue scheduling is used. In this, processes are divided into various classes depending upon property of processes such as system process, I/O process, etc. Thus we get 'n' number of queues for n classes of proc
3 min read
Advantages and Disadvantages of various Disk scheduling algorithms
Prerequisite - Disk Scheduling Algorithms 1. First Come First Serve (FCFS) : Advantages - First Come First Serve algorithm has a very simple logic, it executes the process requests one by one in the sequence they arrive. Thus, First Come First Serve is very simple and easy to understand and implement. In FCFS eventually, each and every process gets
3 min read
SSTF Full Form
SSTF (Shortest Seek Time First) is an abbreviation that selects the request which is closest to the current head position before moving the head away to service other requests. This is done by selecting the request which has the least seek time from the current head position. SSTF scheduling priority is given to those processes which have the short
3 min read
FCFS Disk Scheduling Algorithms
Prerequisite: Disk scheduling algorithms.Given an array of disk track numbers and initial head position, our task is to find the total number of seek operations done to access all the requested tracks if First Come First Serve (FCFS) disk scheduling algorithm is used. First Come First Serve (FCFS) FCFS is the simplest disk scheduling algorithm. As
6 min read
N-Step-SCAN disk scheduling
The input-output requests that are coming from the disk are scheduled by the operating system and that scheduling of the disk is known as disk scheduling. Disk scheduling is important since multiple requests come from processes for disk but only one disk is assigned to process at a time. Seek time is one of the crucial parameters in the operating s
5 min read