From e2e57a4fe7b85eac865c1cbec14529f554a3a79f Mon Sep 17 00:00:00 2001 From: Rushil Umaretiya Date: Thu, 18 Apr 2024 02:34:54 -0400 Subject: [PATCH] fixed printing --- out.txt | 5 ----- schedule.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/out.txt b/out.txt index 3cef0f8..e69de29 100644 --- a/out.txt +++ b/out.txt @@ -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 ] diff --git a/schedule.c b/schedule.c index 4be0c99..befb009 100644 --- a/schedule.c +++ b/schedule.c @@ -6,7 +6,7 @@ #include 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; } }