Merge 'task1/priority-donation' into 'master' #14

Merged
sb3923 merged 66 commits from task1/priority-donation into master 2024-10-23 16:15:45 +00:00
4 changed files with 172 additions and 10 deletions
Showing only changes of commit 44de31c0ff - Show all commits

View File

@@ -386,10 +386,7 @@ thread_set_priority (int new_base_priority)
return; return;
t->base_priority = new_base_priority; t->base_priority = new_base_priority;
t->priority = new_base_priority; thread_recalculate_priority ();
if (new_base_priority < old_priority)
thread_recalculate_priority ();
thread_yield (); thread_yield ();
} }
@@ -406,6 +403,7 @@ void
thread_recalculate_priority (void) thread_recalculate_priority (void)
{ {
struct thread *t = thread_current (); struct thread *t = thread_current ();
t->priority = t->base_priority;
if (!list_empty (&t->donors_list)) { if (!list_empty (&t->donors_list)) {
int max_donated_priority = int max_donated_priority =