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

N-Step-SCAN Disk Scheduling

Before you study about N-Step-SCAN Disk Scheduling, it requires prerequisite of what is Disk Scheduling Algorithms: Operating systems use disc scheduling to schedule I/O requests that arrive at the disc. I/O scheduling is another name for disc scheduling.

  • Multiple I/O requests may arrive from distinct processes, but the disc controller can only handle one I/O request at a time. As a result, further I/O requests must wait in the queue and be scheduled.
  • Two or more requests may be separated by a significant distance, resulting in increased disc arm movement.
  • Hard drives are one of the slowest components in a computer system, thus they must be accessed quickly.

There are many disk scheduling algorithms, but before we get into them, let's look at a few key terms:

  • Seek Time: The time taken by the disk arm to identify a specific track where data is to be read or written is known as seek time. As a result, the disc scheduling technique with the shortest average seek time is preferable.
  • Rotational latency is the time it takes to rotate the required area of ??the disk into position so that the read/write heads can be reached. As a result, the disc scheduling approach with the shortest rotational delay is preferable.
  • The time it takes to send data is known as the transfer time. It is determined by the disk's rotational speed and the quantity of bytes to be transmitted.
  • Disk Response Time: Response Time is the average amount of time a request spends waiting for an I/O operation to complete. The average response time is the sum of all requests' responses. Variance Response Time is a metric that measures how quickly individual requests are handled in comparison to the average response time. As a result, the disc scheduling algorithm with the shortest variance response time is preferable.

Disk Scheduling Algorithms:

  • FCFS also known as First Come First Serve algorithm is the most basic of the Disk Scheduling Algorithms. Requests are handled in FCFS in the order they come in the disc queue.
  • SSTF (Shortest Search Time First): In SSTF (Shortest Seek Time First), the requests with the shortest seek time are processed first. As a result, each request's seek time is computed before hand in the queue, and then they are scheduled on the basis of determined seek time. As a result, the closest request to the disc arm will be processed first. SSTF is a significant improvement over FCFS, since it reduces average response time and enhances system throughput.
  • Scan: In the scan algorithm, the disk arm moves in a certain direction and serves the requests in its path, then reverses the direction and serves the incoming requests again after reaching the end of the disk. Consequently, this algorithm is also known as an elevator algorithm because it acts like an elevator. As a result, requests at the midpoint get more attention, while those after the disk arm must wait.
  • CSCAN: In the SCAN algorithm, the disc arm scans the previously scanned route again after reversing its orientation. As a result, it's conceivable that there are too many requests outstanding on the other end, or that there are none or only a few requests awaiting in the scanned region.


The operating system schedules the disk's input and output requests, and this disc scheduling is known as disc scheduling. Because several requests for disc occur from processes, yet only one disc is allotted to each process at a time, disc scheduling is critical. One of the most important parameters in an operating system is seek time. As a result of the requests being connected in queues, the seek time increases, causing the system to slow down. The Disk Scheduling Algorithm is a disc scheduling algorithm whose goal is to decrease overall seek time.

N-Step-SCAN is a Disk Scheduling Algorithm that is also known as N-Step-Look. It aids in the determination of Disk's arm motion as well as the processing of read and write requests. It divides the request queue into N-length sub queues. It guarantees that the service guarantee aim is met in this way. Following this, following requests cannot be assigned into N size sub queues since the elevator algorithm has filled them. As a result, hunger is totally avoided, and service within N requests is assured.


  1. For N requests, a buffer is established.
  2. In any given wipe, all of the requests that are retained in this buffer are handled.
  3. During this period, any new incoming requests will be maintained in a separate buffer and will not be added to this buffer.
  4. Now comes the function of the I/O (Input Output) scheduler, since after these top N requests have been fulfilled, the I/O (Input Output) scheduler selects the next N requests, and so on.

By doing so, N-Step-SCAN improves throughput and eliminates thrust.

Example of N-Step Disk Scheduling:

Allow the following tracks from a moving head disc with 200 tracks, numbered 0 to 199, to be requested in the following order: 122, 90, 160, 24, 102, 89, 143, 18, 67. The requested tracks are split into the subqueues below for N = 2.

  • subqueue 1 = {122, 90}
  • subqueue 2 = {160, 24}
  • subqueue 3 = {102, 89}
  • subqueue 4 = {143, 18}
  • subqueue 5 = {67}

For disc scheduling, sub-queue 1 with request tracks 122 and 90 is picked first. Track 90 is processed first since it is close to zero. Track 122 is processed after track 90 has been processed.

At this time, the disc head is on track 122. A track from sub-queue 2 that is closer to 122 is chosen for processing. As a result, track 160 gets chosen. Because there are no more tracks between 160 and 199 to analyse, the head travels to the last track, 199, and reverses its course to continue processing the request for track 24.

After then, the request tracks 102 and 89 in sub-queue 3 will be handled. 89 gets processed first, followed by 102, since it is closer to 24. The requests in sub-queues 4 and 5 are handled in the same way. The N-step-SCAN disc scheduling technique provides a high throughput and a short mean response time.