diff --git a/simulator.c b/simulator.c index 635f081..4fcbe76 100644 --- a/simulator.c +++ b/simulator.c @@ -4,7 +4,7 @@ #define RR_QUANTUM 2 #define CNTXT_SWITCH 1 -#define MAX_PROCESSES 10 +int MAX_PROCESSES = 0; enum pstate { WAITING, @@ -598,6 +598,8 @@ struct pinfo * read_file() { struct pinfo * process; while (fgets(line, buf_size, file)) { + + MAX_PROCESSES += 1; pid_str = strtok(line, " "); arrival_str = strtok(NULL, " "); execution_str = strtok(NULL, " "); @@ -625,7 +627,10 @@ struct pinfo * read_file() { } free(line); fclose(file); + + printf("Maximum des processus : %d\n", MAX_PROCESSES); return first; + } void free_processes(struct pinfo * next) {