1
0

added remaining time member to pinfo

This commit is contained in:
Louis Heredero 2024-10-08 15:24:55 +02:00
parent 35cf8505c9
commit 4f7893b70e
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7

View File

@ -19,6 +19,7 @@ struct pinfo {
int wait_time; int wait_time;
int completion_time; int completion_time;
int remaining_time;
enum pstate state; enum pstate state;
struct pinfo * next_pinfo; struct pinfo * next_pinfo;
@ -44,6 +45,7 @@ void print_pinfo(struct pinfo * info) {
printf(" Priority: %d\n", info->priority); printf(" Priority: %d\n", info->priority);
printf(" Wait time: %d\n", info->wait_time); printf(" Wait time: %d\n", info->wait_time);
printf(" Completion time: %d\n", info->completion_time); printf(" Completion time: %d\n", info->completion_time);
printf(" Remaining time: %d\n", info->remaining_time);
printf(" NEXT -> %p\n", info->next_pinfo); printf(" NEXT -> %p\n", info->next_pinfo);
printf("}>\n"); printf("}>\n");
} }
@ -63,6 +65,7 @@ struct pinfo * create_process(int id, int arrival_time, int execution_time, int
info->priority = priority; info->priority = priority;
info->wait_time = 0; info->wait_time = 0;
info->completion_time = 0; info->completion_time = 0;
info->remaining_time = execution_time;
info->state = WAITING; info->state = WAITING;
info->next_pinfo = NULL; info->next_pinfo = NULL;
return info; return info;