From c42a9b4418a4691919e3b28c0f00cdb06a32ad79 Mon Sep 17 00:00:00 2001 From: Rushil Umaretiya Date: Thu, 18 Apr 2024 02:29:31 -0400 Subject: [PATCH] fixed segfault --- schedule.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/schedule.c b/schedule.c index 0b7364d..3ffbe70 100644 --- a/schedule.c +++ b/schedule.c @@ -21,8 +21,10 @@ void run_with_quantum(task_struct* task, unsigned int quantum) { } void fcfs() { + printf("Running FCFS\n"); + while (get_task(0) != NULL) { - run_to_completion(remove_task(0)); + run_to_completion(remove_task(get_task(0)->pid)); } } @@ -33,7 +35,7 @@ void priority_queue(unsigned int quantum) { task_struct* task = get_task(0); run_with_quantum(task, quantum); if (task->remaining_cycles > 0) { - remove_task(0); + remove_task(task->pid); } min_heapify();