Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ int main()
{

char sched_policy[4];
int policy;
enum Policy policy;
int nproc;
struct process *proc;

scanf("%4s", sched_policy);

if (strcmp(sched_policy, "FIFO") == 0) {
policy = FIFO;
}
Expand All @@ -39,7 +39,7 @@ int main()
fprintf(stderr, "Invalid number of processes.(Or policy exceeds 4 characters)");
exit(0);
}

proc = (struct process *)malloc(nproc * sizeof(struct process));

for (int i = 0; i < nproc; i++) {
Expand Down
9 changes: 3 additions & 6 deletions scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@

#include "process.h"

#define FIFO 1
#define RR 2
#define SJF 3
#define PSJF 4
enum Policy{FIFO, RR, SJF, PSJF};

void schedule(struct process *, int num_proc, int policy);
void schedule(struct process *, int num_proc, enum Poilcy policy);

#endif
#endif