Example of First Come First Serve Algorithm
Example of First Come First Serve Algorithm
Q. Consider the four jobs are scheduled for execution (all jobs arrived at same time). Find
the average waiting time and turnaround time.
Gantt Chart:
Q.Program of First Come First Serve Algorithm :
// Print totals and averages
#include <stdio.h> printf("\nTotal Waiting Time: %d",
struct Process totalWaitingTime);
{
int pid; // Process ID printf("\nTotal Turnaround Time: %d",
int burstTime; // Burst Time totalTurnaroundTime);
int waitingTime; // Waiting Time
int turnAroundTime; // Turnaround Time printf("\nAverage Waiting Time: %.2f",
}; (float)totalWaitingTime / n);