"os SJF scheduling algorithms in c" Code Answer's

You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "os SJF scheduling algorithms in c" answered properly. Developers are finding an appropriate answer about os SJF scheduling algorithms in c related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like os SJF scheduling algorithms in c. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on os SJF scheduling algorithms in c. 

os SJF scheduling algorithms in c

By Cruel CorncrakeCruel Corncrake on Apr 16, 2021
#include<stdio.h>
 int main()
{
    int bt[20],p[20],wt[20],tat[20],i,j,n,total=0,pos,temp;
    float avg_wt,avg_tat;
    printf("Enter number of process:");
    scanf("%d",&n);
  
    printf("nEnter Burst Time:n");
    for(i=0;i<n;i++)
    {
        printf("p%d:",i+1);
        scanf("%d",&bt[i]);
        p[i]=i+1;         
    }
  
   //sorting of burst times
    for(i=0;i<n;i++)
    {
        pos=i;
        for(j=i+1;j<n;j++)
        {
            if(bt[j]<bt[pos])
                pos=j;
        }
  
        temp=bt[i];
        bt[i]=bt[pos];
        bt[pos]=temp;
  
        temp=p[i];
        p[i]=p[pos];
        p[pos]=temp;
    }
   
    wt[0]=0;            
  
   
    for(i=1;i<n;i++)
    {
        wt[i]=0;
        for(j=0;j<i;j++)
            wt[i]+=bt[j];
  
        total+=wt[i];
    }
  
    avg_wt=(float)total/n;      
    total=0;
  
    printf("nProcesst    Burst Time    tWaiting TimetTurnaround Time");
    for(i=0;i<n;i++)
    {
        tat[i]=bt[i]+wt[i];   
        total+=tat[i];
        printf("np%dtt  %dtt    %dttt%d",p[i],bt[i],wt[i],tat[i]);
    }
  
    avg_tat=(float)total/n;    
    printf("nnAverage Waiting Time=%f",avg_wt);
    printf("nAverage Turnaround Time=%fn",avg_tat);
}

Source: www.edureka.co

Add Comment

0

scheduling algorithm os c code

By Cute CaimanCute Caiman on Mar 17, 2021
#include <stdio.h>
  
int main() 
{
      int arrival_time[10], burst_time[10], temp[10];
      int i, smallest, count = 0, time, limit;
      double wait_time = 0, turnaround_time = 0, end;
      float average_waiting_time, average_turnaround_time;
      printf("nEnter the Total Number of Processes:t");
      scanf("%d", &limit); 
      printf("nEnter Details of %d Processesn", limit);
      for(i = 0; i < limit; i++)
      {
            printf("nEnter Arrival Time:t");
            scanf("%d", &arrival_time[i]);
            printf("Enter Burst Time:t");
            scanf("%d", &burst_time[i]); 
            temp[i] = burst_time[i];
      }
      burst_time[9] = 9999;  
      for(time = 0; count != limit; time++)
      {
            smallest = 9;
            for(i = 0; i < limit; i++)
            {
                  if(arrival_time[i] <= time && burst_time[i] < burst_time[smallest] && burst_time[i] > 0)
                  {
                        smallest = i;
                  }
            }
            burst_time[smallest]--;
            if(burst_time[smallest] == 0)
            {
                  count++;
                  end = time + 1;
                  wait_time = wait_time + end - arrival_time[smallest] - temp[smallest];
                  turnaround_time = turnaround_time + end - arrival_time[smallest];
            }
      }
      average_waiting_time = wait_time / limit; 
      average_turnaround_time = turnaround_time / limit;
      printf("nnAverage Waiting Time:t%lfn", average_waiting_time);
      printf("Average Turnaround Time:t%lfn", average_turnaround_time);
      return 0;
}

Source: www.edureka.co

Add Comment

0

All those coders who are working on the Whatever based application and are stuck on os SJF scheduling algorithms in c can get a collection of related answers to their query. Programmers need to enter their query on os SJF scheduling algorithms in c related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about os SJF scheduling algorithms in c for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of os SJF scheduling algorithms in c while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "os SJF scheduling algorithms in c". Visit this developer's friendly online web community, CodeProZone, and get your queries like os SJF scheduling algorithms in c resolved professionally and stay updated to the latest Whatever updates. 

Whatever answers related to "os SJF scheduling algorithms in c"

View All Whatever queries

Whatever queries related to "os SJF scheduling algorithms in c"

Browse Other Code Languages

CodeProZone