1 /* Problem 1-3: Priority Scheduling tests.
3 Based on a test originally submitted for Stanford's CS 140 in
4 winter 1999 by by Matt Franklin
5 <startled@leland.stanford.edu>, Greg Hutchins
6 <gmh@leland.stanford.edu>, Yu Ping Hu <yph@cs.stanford.edu>.
10 #error This test not applicable with MLFQS enabled.
13 #include "threads/test.h"
15 #include "threads/synch.h"
16 #include "threads/thread.h"
18 static void test_preempt (void);
23 /* Make sure our priority is the default. */
24 ASSERT (thread_get_priority () == PRI_DEFAULT);
29 static thread_func simple_thread_func;
35 "Testing priority preemption.\n");
36 thread_create ("high-priority", PRI_DEFAULT + 1, simple_thread_func, NULL);
37 printf ("The high-priority thread should have already completed.\n"
38 "Priority preemption test done.\n");
42 simple_thread_func (void *aux UNUSED)
46 for (i = 0; i < 5; i++)
48 printf ("Thread %s iteration %d\n", thread_name (), i);
51 printf ("Thread %s done!\n", thread_name ());