Allow priority donation with BSD scheduler.

- Recalculate priority with donations after BSD priority updates
- Remove mlfqs checks from lock_acquire
This commit is contained in:
2024-10-25 14:03:55 +01:00
parent af31968e67
commit 6e072a557f
2 changed files with 29 additions and 30 deletions

View File

@@ -252,26 +252,17 @@ lock_acquire (struct lock *lock)
struct thread *t = thread_current ();
if(!thread_mlfqs)
{
enum intr_level old_level = intr_disable ();
if (lock->holder != NULL)
{
t->waiting_lock = lock;
donate_priority (lock->holder);
}
intr_set_level (old_level);
}
enum intr_level old_level = intr_disable ();
if (lock->holder != NULL)
{
t->waiting_lock = lock;
donate_priority (lock->holder);
}
intr_set_level (old_level);
sema_down (&lock->semaphore);
lock->holder = thread_current ();
if (!thread_mlfqs)
t->waiting_lock = NULL;
t->waiting_lock = NULL;
}
/* Tries to acquires LOCK and returns true if successful or false