X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Ftests%2Fthreads%2Fpriority-donate-one.c;h=2a67b52e0960f99bbfba53ba757f8c2967b17cb4;hb=cf6f97138af7627600523c6d2de571c379667771;hp=5a30bd47e298ead7bf1fdb3143a9b23547d76ec5;hpb=f2bc7b1760b7257089e2007755f9e53a47d7067a;p=pintos-anon diff --git a/src/tests/threads/priority-donate-one.c b/src/tests/threads/priority-donate-one.c index 5a30bd4..2a67b52 100644 --- a/src/tests/threads/priority-donate-one.c +++ b/src/tests/threads/priority-donate-one.c @@ -1,4 +1,8 @@ -/* Problem 1-3: Priority Scheduling tests. +/* The main thread acquires a lock. Then it creates two + higher-priority threads that block acquiring the lock, causing + them to donate their priorities to the main thread. When the + main thread releases the lock, the other threads should + acquire it in priority order. Based on a test originally submitted for Stanford's CS 140 in winter 1999 by Matt Franklin , @@ -27,12 +31,12 @@ test_priority_donate_one (void) lock_init (&lock); lock_acquire (&lock); - thread_create ("acquire1", PRI_DEFAULT - 1, acquire1_thread_func, &lock); + thread_create ("acquire1", PRI_DEFAULT + 1, acquire1_thread_func, &lock); msg ("This thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT - 1, thread_get_priority ()); - thread_create ("acquire2", PRI_DEFAULT - 2, acquire2_thread_func, &lock); + PRI_DEFAULT + 1, thread_get_priority ()); + thread_create ("acquire2", PRI_DEFAULT + 2, acquire2_thread_func, &lock); msg ("This thread should have priority %d. Actual priority: %d.", - PRI_DEFAULT - 2, thread_get_priority ()); + PRI_DEFAULT + 2, thread_get_priority ()); lock_release (&lock); msg ("acquire2, acquire1 must already have finished, in that order."); msg ("This should be the last line before finishing this test.");