1
0

Merge branch 'main' of git.kb28.ch:HEL/OS-Lab-Scheduler

This commit is contained in:
Louis Heredero 2024-10-15 13:55:19 +02:00
commit 4e527bccfe
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7

View File

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