C program for first come first serve scheduling.

Posted by Mangesh on May 02, 2018

/* first come first serve algorithm for scheduling. */

Description :

The simplest CPU scheduling algorithm is the first come first served scheduling(FCFS) algorithm. The process that requests the CPU first is allocated the CPU first. A queue of waiting processes is maintained in FCFS order. When a process completes, thw next process in the queue is allocated the CPU. The FCFS algorithm is non pre- emptive.

Program :

void main()
 int bursttime[100],responsetime[100],turnaroundtime[100];
 int i,n,totalRT=0,totalTT=0;
 printf("Enter total number of process : ");
  printf("\nEnter the burst time of %d process : ",i+1);
  printf("process number \t\tResponse time\t\t Turnaround time");
 responsetime[0] = 0;

  printf("\n \t%d \t\t\t %d \t\t\t %d",i+1,responsetime[i],turnaroundtime[i]);
   totalRT = totalRT + responsetime[i];
   totalTT = totalTT + turnaroundtime[i];
 printf("\nAverage waiting time is %f",(float)totalRT/n);
 printf("\nAverage response time is %f",(float)totalRT/n);
 printf("\nAverage turnaround time is %f ",(float)totalTT/n);

Output :

c program for first come first serve Executed and tested in Turbo C 3.2

Written with from Mangesh.

Related Post
1 C program for first come first serve scheduling.
2 C program for shortest job first scheduling algorithm.
3 C program for shortest remaining time first scheduling algorithm.
4 C program for round robin scheduling algorithm.
Latest Post
1 C program to implement Queue using linked list.
2 C program for binary search tree (BST).
3 C program to search an element in linked list.
4 C program for postorder traversal in binary tree.
5 C program for preorder traversal in binary tree.