diff --git a/src/threads/thread.c b/src/threads/thread.c index 9e2fa41..d488677 100644 --- a/src/threads/thread.c +++ b/src/threads/thread.c @@ -261,7 +261,11 @@ thread_create (const char *name, int priority, /* Add to run queue. */ thread_unblock (t); - thread_yield (); + + /* Yield if the newly created thread has higher priority than the current + thread. */ + if (t->priority > thread_current ()->priority) + thread_yield (); return tid; }