Merge implementations of priority scheduling by Themis and Saleh #11

Closed
td1223 wants to merge 14 commits from task1/priority-scheduling into task1/merged/priority-scheduling
4 changed files with 24 additions and 131 deletions
Showing only changes of commit 6855a48603 - Show all commits

View File

@@ -68,7 +68,8 @@ sema_down (struct semaphore *sema)
old_level = intr_disable ();
while (sema->value == 0)
{
list_push_back (&sema->waiters, &thread_current ()->elem);
list_insert_ordered (&sema->waiters, &thread_current ()->elem,
&thread_priority_greater, NULL);
thread_block ();
}
sema->value--;
@@ -118,6 +119,7 @@ sema_up (struct semaphore *sema)
struct thread, elem));
sema->value++;
intr_set_level (old_level);
thread_yield ();
}
static void sema_test_helper (void *sema_);