fixed printing

This commit is contained in:
Rushil Umaretiya 2024-04-18 02:34:54 -04:00
parent a3fc714ffc
commit e2e57a4fe7
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959
2 changed files with 2 additions and 7 deletions

View File

@ -1,5 +0,0 @@
Number of tasks: pid priority cycles: pid priority cycles: pid priority cycles: pid priority cycles: pid priority cycles: pid priority cycles: pid priority cycles: ---- Tasks ----
(num_tasks) [pid:priority:cycles:priority/cycles ...]
(7) [ 1:5:10:0.50 2:16:17:0.94 3:8:24:0.33 4:1:36:0.03 5:99:100:0.99 6:1:62:0.02 0:26:80:0.32 ]
Select scheduling algorithm (0: Display min heap, 1: FCFS, 2: Priority queue, 3: Round robin): ---- Min heap ----
(7) [ 6:1:62:0.02 4:1:36:0.03 0:26:80:0.32 2:16:17:0.94 5:99:100:0.99 3:8:24:0.33 1:5:10:0.50 ]

View File

@ -6,7 +6,7 @@
#include <stdlib.h>
void run_to_completion(task_struct* task) {
printf("Task %d ran for %d cycle(s).\n", task->pid, task->remaining_cycles);
printf("Task %d ran for %d cycles.\n", task->pid, task->remaining_cycles);
task->remaining_cycles = 0;
printf("Task %d completed.\n", task->pid);
}
@ -15,7 +15,7 @@ void run_with_quantum(task_struct* task, unsigned int quantum) {
if (task->remaining_cycles <= quantum) {
run_to_completion(task);
} else {
printf("Task %d ran for %d cycle(s).\n", task->pid, quantum);
printf("Task %d ran for %d cycles.\n", task->pid, quantum);
task->remaining_cycles -= quantum;
}
}