Home / C / Program for First Come First Serve (FCFS) scheduling technique

Program for First Come First Serve (FCFS) scheduling technique

This is the program for First Come First Serve scheduling technique usually implemented in Operating system for scheduling programs

#include "stdio.h"
#include "conio.h"
void main()
{
int i,npro,btime[30],wtime[30],turntime[30],avgwtime,temp=0;
clrscr();
printf("\nEnter the no. of Programs");
scanf("%d",&npro);
for(i=0;i<npro;i++)
{
printf("\nEnter the burst time of process %d",i+1);
scanf("%d",&btime[i]);
}
//Calculation start for First Come First Serve Scheduling
wtime[0]=0;
for(i=1;i<npro;i++)
{
wtime[i]=btime[i-1]+wtime[i-1];
}
for(i=0;i<npro;i++)
{
temp=temp+wtime[i];
}
avgwtime=temp/npro;
for(i=0;i<npro;i++)
{
turntime[i]=wtime[i]+btime[i];
}
for(i=0;i<npro;i++)
{
printf("\nTurnaround Time Of Process %d is %d",i+1,turntime[i]);
}
for(i=0;i<npro;i++)
{
printf("\nWaiting Time Of Process %d is %d",i+1,wtime[i]);
}
printf("\nAverage Waiting Time Is %d",avgwtime);
getch();
}

 

OUTPUT

 

Incoming Terms: C program for FCFS, First Come first Serve scheduling Program.

Also See:   C Program for Sunrise Animation using Graphics

Check Also

How to Solve Linear Equation in One Variable In C Programming?

C Program to Solve any Linear Equation in One Variable Find complete C program to ...

One comment

  1. nice program… 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *