Operating System Tutorial

What is Operating System Evolution of Operating System Types of Operating System Functions of Operating System What is Kernel and Types of Kernel Operating System Properties Operating System Services Components of Operating System Needs of the Operating System Linux Operating System Unix Operating System Ubuntu Operating System What is DOS Operating System Difference Between Multi-programming and Multitasking What is Thread and Types of Thread Process Management Process State What is Process Scheduler and Process Queue What is Context Switching What is CPU Scheduling Scheduling Algorithm FCFS (First-come-First-Serve) Scheduling SJF (Shortest Job First) Scheduling Round-Robin CPU Scheduling Priority Based Scheduling HRRN (Highest Response Ratio Next) Scheduling Process Synchronization Lock Variable Mechanism TSL Mechanism Turn Variable Mechanism Interested Variable Mechanism What is Producer-Consumer Problem What is Semaphore in Operating System Monitors in Operating System What is Deadlock Deadlock Avoidance Strategies for Handling Deadlock Deadlock Prevention Deadlock Detection and Recovery Resource Allocation Graph Banker’s Algorithm in Operating System Fixed Partitioning and Dynamic Partitioning Partitioning Algorithms What is Paging and Segmentation What is Demand Paging What is Virtual Memory Disk Scheduling Algorithms FCFS and SSTF Disk Scheduling Algorithm SCAN and C-SCAN Disk Scheduling Algorithm Look and C-Look Disk Scheduling Algorithm File in Operating System File Access Methods in Operating System File Allocation Method Directory Structure in Operating System Difference between C-LOOK and C-SCAN Difference between Rotational Latency and Disk Assess Time Trap vs Interrupt How to implement Monitors using Semaphores N-Step-SCAN Disk Scheduling Why is it critical for the Scheduler to distinguish between I/O-bound and CPU-bound programs Difference between C-SCAN and SSTF Difference between SCAN and FCFS Difference between Seek Time and Disk Access Time Difference between SSTF and LOOK

Difference between C-SCAN and SSTF Disk Scheduling Algorithm

C-SCAN / Circular Elevator

The circular SCAN (C-SCAN) scheduling method is a modified version of the SCAN disc scheduling technique that addresses the SCAN algorithm's inefficiency by more equitably serving requests. C-SCAN, like the SCAN (lift algorithm), moves the head from one end to the other, fulfilling all requests. However, once the head reaches the other end, it returns to the start of the disk without any requests along the way (see chart below) and starts serving again after reaching the start. The "Circular Elevator Algorithm" is named by the fact that it interprets the cylinders as a circular list that loops around from the last to the first.

Benefits:

  • This ensures a consistent wait time.
  • This allows for faster response times.
  • The head moves from one end of the disk to the other, fulfilling all requests along the way.
  • The C-SCAN scheduling method is an upgraded variant of the SCAN algorithm.

Drawback:

  • It might not be fair to service requests for tunes on the furthest reaches of the spectrum.
  • When compared to the SCAN Algorithm, it has more seek motions.

Example:

Consider a disc with 180 tracks (0-179) and a disc queue with input/output requests in the following order: 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40, 135, 50, 170, 65, 10, 75, 90, 40 The Read/Write head's starting position is 45 degrees, and it will travel to the right. Using the C-SCAN method, determine the total number of track movements of the Read/Write head.

Answer:

Difference Between C-SCAN And SSTF Disk Scheduling Algorithm

Head motions in total,

The starting position for the head is 45 degrees.

= (50-45) + (65-50) + (75-65) + (90-75) + (135-90) + (170-135) + (179-170) + (179-0) + (10-0) + (179-170) + (179-0) + (10-0) + (40-10)

= 15 + 45 + 35 + 9 +179 + 10 + 30 = 5 + 15 + 10 +15 + 45 + 35 + 9 +179 + 10 + 30

= 353

SSTF Disk Scheduling Algorithm

Shortest Seek Time First (SSTF) is an acronym for "shortest seek time first." This approach fulfils the task request that is closest to the present location of the head or pointer, as the name implies. In this case, the direction of the head is crucial in calculating total head movement. If there is a tie between requests, the head will serve the request that comes first in the order in which it was received. In comparison to C-LOOK, the SSTF algorithm is extremely efficient in terms of overall search time. SSTF scheduling priority is given to processes that have the fewest searches. To do this, the time of each request is calculated in advance in the queue, and then requests are scheduled based on their search time.

Benefits:

  • It enhances and expands throughput.
  • The overall seek time of the SSTF is less than that of the FCFS.
  • It offers a faster response time and a shorter average wait time.

Drawback:

  • Requests made far from the head might result in starvation.
  • The significant variation in response time and waiting time is accessible in the SSTF disc scheduling technique.
  • Frequent changes in the direction of the head slow down the algorithm.

Example:

To further understand the SSTF Disk Scheduling Algorithm, let's look at an example. Consider a disc with 180 tracks (0-179) and a disc queue with the following input/output requests: 92, 100, 40, 148, 67, 170, 29, ten, ten, ten, ten, ten, ten, ten, ten, ten The Read/Write head's starting position is 45 degrees, and it will shift to the left side. Using the SSTF technique, calculate the total number of track movements for the read/write head.

Answer:

Difference Between C-SCAN And SSTF Disk Scheduling Algorithm

Head motions in total,

The initial head point is 45 degrees.

= (45-40) + (40-29) + (29-10) + (67-10) + (92-67) + (100-92) + (148-100) + (100-92) + (148-100) + (170-148)

= 5 + 11 + 19 + 57 + 25 + 8 + 48 + 22 = 5 + 11 + 19 + 57 + 25 + 8 + 48 + 22

=195

Major Differences

S no.C-SCANSSTF
1.The C-SCAN algorithm can only handle queries in one way at a timeThe SSTF algorithm, on the other hand, can handle requests in both directions.  
2.In terms of average waiting and reaction time, the C-SCAN algorithm has a low variance.The SSTF disc scheduling technique, on the other hand, has a wide range of response times and average waiting times.
3.More seek time is caused by the C-SCAN disc scheduling method.The SSTF disc scheduling technique, on the other hand, bears the overhead of locating the nearest request.
4.Requests would never be denied due to the C-SCAN disc scheduling method.The SSTF disc scheduling technique, on the other hand, has the potential to create starvation.



ADVERTISEMENT
ADVERTISEMENT