fixed segfault

This commit is contained in:
Rushil Umaretiya 2024-04-18 02:29:31 -04:00
parent aca8171c39
commit c42a9b4418
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959

View File

@ -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();