Top 10 Programming Language to learn in 2023

Are you a programming enthusiast looking to stay ahead of the curve in 2023? With the ever-evolving tech landscape, keeping up with the Best Programming Language to learn can be a daunting task. Fear not, as we have compiled a list of the top 10 Programming Languages that you should consider learning in 2023. Python: This versatile language continues to dominate in 2023, with its ease of use, readability, and a vast library of modules. JavaScript: As web development grows increasingly popular, JavaScript remains a crucial player, with its ability to create dynamic and interactive web pages. Java: This language has stood the test of time and remains a popular choice for enterprise software development. C++: A staple in the gaming and systems development industries, C++ offers exceptional performance and memory management. Swift: Apple's preferred language for iOS app development, Swift continues to grow in popularity with its simplicity and reliability. R: As data science and machin

C Program For Shortest Seek Time Next Disk Scheduling Algorithm | C Programming

Introduction to SSTF disk scheduling :

SSTF stands for Shortest Time First which very uses full of learning about how the disk drive manages the data having the shortest seek time.



Algorithm of the SSTF is given below:-

  • Find the positive distance of all tracks in the request array from the head.
  • Find a track from the requested array which has not been accessed/serviced yet and has a minimum distance from the head.
  • Increment the total seek count with this distance.
  • Currently serviced track position now becomes the new head position.
  • Go to step 2 until all tracks in request array have not been serviced.

C program for Shortest Seek Time Next Disk Scheduling Algorithm 



#include <stdio.h>
#include <conio.h>
#include <math.h>
int main()
{
    int queue[100], t[100], head, seek = 0, n, i, j, temp;
    float avg;
    // clrscr();
    printf("*** SSTF Disk Scheduling Algorithm ***\n");
    printf("Enter the size of Queue\t");
    scanf("%d", &n);
    printf("Enter the Queue\t");
    for (i = 0; i < n; i++)
    {
        scanf("%d", &queue[i]);
    }
    printf("Enter the initial head position\t");
    scanf("%d", &head);
    for (i = 1; i < n; i++)
        t[i] = abs(head - queue[i]);
    for (i = 0; i < n; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            if (t[i] > t[j])
            {
                temp = t[i];
                t[i] = t[j];
                t[j] = temp;
                temp = queue[i];
                queue[i] = queue[j];
                queue[j] = temp;
            }
        }
    }
    for (i = 1; i < n - 1; i++)
    {
        seek = seek + abs(head - queue[i]);
        head = queue[i];
    }
    printf("\nTotal Seek Time is%d\t", seek);
    avg = seek / (float)n;
    printf("\nAverage Seek Time is %f\t", avg);
    return 0;
}

You May Also Like:

C Program for SCAN disk scheduling algorithm 

C program for First Come First Serve (FCFS) disk scheduling algorithm | C Programming


C program for Shortest Seek Time Next Disk Scheduling Algorithm | C Programming


C++ program for LOOK Disk Scheduling Algorithm | C++ Programming


C Program for C-SCAN Disk Scheduling Algorithm | C Programming


C++ Program For C-LOOK Disk Scheduling Algorithm | C++ Programming


Comments

Popular posts from this blog

Array in C Programming | C Programming

C program to Find Cartesian Product of Two Sets | C programming

What is System? | SAD