FCFS and SJF CPU Scheduling C Program Example
FCFS and SJF CPU Scheduling C Program Example
Corrected and formatted C source code for FCFS and SJF scheduling.
FCFS Scheduling C Implementation
#include <stdio.h>
int FCFS() {
int bt[15], n, i, wt[15];
float twt = 0, tat = 0, att, awt;
printf("\nTHE FCFS SCHEDULING\n");
printf("Enter the number of processes: ");
scanf("%d", &n);
printf("Enter burst time of all the processes:\n");
for (i = 0; i < n; i++) {
printf("P%d: ", i + 1);
scanf("%d", &bt[i]);
}
wt[0] = 0;
// for calculating waiting time of each process
for (i = 1; i < n; i++)
wt[i] = bt[i - 1] + wt[i - 1];
printf("ProcessID\tBurstTime\tWaitingTime\tTurn Around Time\n");
for (i = 0; i <... Continue reading "FCFS and SJF CPU Scheduling C Program Example" »
English with a size of 3.03 KB