This commit is contained in:
Rushil Umaretiya 2024-04-18 19:30:59 -04:00
parent 61ab29b07c
commit 7cd5b2b92c
No known key found for this signature in database
GPG Key ID: 4E8FAF9C926AF959

3
task.c
View File

@ -201,7 +201,8 @@ void heapify(int i) {
float next_ratio =
(float)next->priority / (float)next->remaining_cycles;
if (curr_ratio > next_ratio) {
if (curr_ratio > next_ratio ||
(curr_ratio == next_ratio && curr->priority > next->priority)) {
swap(curr->pid, next->pid);
k = j;
} else {