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 276 additions and 16 deletions
Showing only changes of commit 95386971e2 - Show all commits

View File

@@ -303,6 +303,7 @@ lock_release (struct lock *lock)
struct list orphan_list; struct list orphan_list;
list_init (&orphan_list); list_init (&orphan_list);
enum intr_level old_level = intr_disable ();
/* Loop through current thread's donors, removing the ones waiting for the /* Loop through current thread's donors, removing the ones waiting for the
lock being released and keeping track of them (within orphan_list). lock being released and keeping track of them (within orphan_list).
Also identifies the highest priority donor thread among them. */ Also identifies the highest priority donor thread among them. */
@@ -336,6 +337,7 @@ lock_release (struct lock *lock)
list_push_back (&max_donor->donors_list, list_pop_front (&orphan_list)); list_push_back (&max_donor->donors_list, list_pop_front (&orphan_list));
} }
intr_set_level (old_level);
/* Removal of donors to this thread may change its effective priority, /* Removal of donors to this thread may change its effective priority,
so recalculate. */ so recalculate. */
thread_recalculate_priority (); thread_recalculate_priority ();