1
0

added print_processes function

This commit is contained in:
Louis Heredero 2024-10-08 15:21:47 +02:00
parent d843d4d068
commit 35cf8505c9
Signed by: HEL
GPG Key ID: 8D83DE470F8544E7

View File

@ -42,10 +42,19 @@ void print_pinfo(struct pinfo * info) {
printf(" Arrival time: %d\n", info->arrival_time); printf(" Arrival time: %d\n", info->arrival_time);
printf(" Execution time: %d\n", info->execution_time); printf(" Execution time: %d\n", info->execution_time);
printf(" Priority: %d\n", info->priority); printf(" Priority: %d\n", info->priority);
printf(" Wait time: %d\n", info->wait_time);
printf(" Completion time: %d\n", info->completion_time);
printf(" NEXT -> %p\n", info->next_pinfo); printf(" NEXT -> %p\n", info->next_pinfo);
printf("}>\n"); printf("}>\n");
} }
void print_processes(struct pinfo * processes) {
while (processes != NULL) {
print_pinfo(processes);
processes = processes->next_pinfo;
}
}
struct pinfo * create_process(int id, int arrival_time, int execution_time, int priority) { struct pinfo * create_process(int id, int arrival_time, int execution_time, int priority) {
struct pinfo * info = malloc(sizeof(struct pinfo)); struct pinfo * info = malloc(sizeof(struct pinfo));
info->id = id; info->id = id;
@ -142,10 +151,11 @@ void free_processes(struct pinfo * next) {
int main() { int main() {
struct pinfo * processes = read_file(); struct pinfo * processes = read_file();
//struct perf_info perf = schedule_FCFS(processes); struct perf_info perf = schedule_FCFS(processes);
//write_file(processes, &perf); //write_file(processes, &perf);
//print_perf(&perf); print_processes(processes);
print_perf(&perf);
free_processes(processes); free_processes(processes);