#include <stdio.h>
#define MAX_TIME 256 // MAX_TIME is max executing time of cpu.
void scheduling_FCFS(int *gantt_chart, int *pid, int *arrival_time, int *burst_time, int reauest_length);
void scheduling_SJF(int *gantt_chart, int *pid, int *arrival_time, int *burst_time, int reauest_length);
void scheduling_RR2(int *gantt_chart, int *pid, int *arrival_time, int *burst_time, int reauest_length);
void scheduling_SRTF(int *gantt_chart, int *pid, int *arrival_time, int *burst_time, int reauest_length);
void equalString(char *str1, char *str2);
void changeToUpperCase(char *str);
int main(int argc, char **args)
{
int fd;
char *method;
int pid[MAX_TIME] = { 0 };
int arrival_time[MAX_TIME] = { 0 };
int burst_time[MAX_TIME] = { 0 };
int number_of_line = 0;
int gantt_chart[MAX_TIME] = { 0 };
if (argc != 3) {
printf("Usage : %s <input file> <FCFS|SJF|RR2|SRTF>\n", args[0]);
}
///////////////////// 1. read input file //////////////////
fd = open(args[1]);
if (fd < 0) { perror(); exit(0); }
/*
* file format =
* "%d %d %d\n", pid[i], arrival_time[i], burst_time[i]
*/
// read file and save into pid, arrival_time, burst_time.
////////////////////// 2. scheduling /////////////////////
if (equalString(changeToUpperCase(method), "FCFS"))
scheduling_FCFS(gantt_chart, pid, arrival_time, burst_time, number_of_line);
else if (...)
sche...;
else if (...)
sche...;
else if (...)
sche...;
else {
// print usage
}
///////////////////// 3. print gantt chart //////////////////
close(fd);
return 0;
}
그냥 복붙만 하면 알아서 완성해줄거야
나는 한도 다 차서 안돌아가
결과 알려주시면 사랑을 드리겠읍니당~