-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
44 lines (36 loc) · 1.52 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/*
* NOTE: See README.md for information on modifying inputs and running the program.
*/
#include <stdio.h>
#include <stdlib.h>
#include "headers.h"
int main()
{
int testCases;
int i = 0;
scanf("%d", &testCases);
printf("================================================================================\n");
while (i < testCases) {
int numberOfProcesses;
scanf("%d", &numberOfProcesses);
printf("Process List %d: \n\n", ++i);
int *processIDs = malloc(sizeof(int) * numberOfProcesses);
int *burstTimes = malloc(sizeof(int) * numberOfProcesses);
int *priorities = malloc(sizeof(int) * numberOfProcesses);
for (int i = 0; i < numberOfProcesses; i++)
{
scanf("%d", &processIDs[i]);
scanf("%d", &burstTimes[i]);
scanf("%d", &priorities[i]);
}
fcfs(numberOfProcesses, processIDs, burstTimes);
printf("--------------------------------------------------------------------------------\n");
sjf(numberOfProcesses, processIDs, burstTimes);
printf("--------------------------------------------------------------------------------\n");
priority(numberOfProcesses, processIDs, burstTimes, priorities);
printf("--------------------------------------------------------------------------------\n");
roundRobin(numberOfProcesses, processIDs, burstTimes);
printf("================================================================================\n");
}
return 0;
}