/* If false (default), use round-robin scheduler.
If true, use multi-level feedback queue scheduler.
- Controlled by kernel command-line options "-o mlfqs".
- Note that the command line is not parsed until well after
- thread_init() is called. */
+ Controlled by kernel command-line option "-o mlfqs". */
bool thread_mlfqs;
static void kernel_thread (thread_func *, void *aux);
allocator before trying to create any threads with
thread_create().
- The kernel command line is not parsed until *after* this
- function returns, so that when this function runs,
- thread_mlfqs is always false.
-
It is not safe to call thread_current() until this function
finishes. */
void
}
/* Starts preemptive thread scheduling by enabling interrupts.
- Also creates the idle thread.
-
- By the time this function runs, thread_mlfqs has been properly
- initialized to its final value. */
+ Also creates the idle thread. */
void
thread_start (void)
{
- /* Create the idle thread with maximum priority. This ensures
- that it will be scheduled soon after interrupts are enabled.
- The idle thread will block almost immediately upon
- scheduling, and subsequently it will never appear on the
- ready list, so the priority here is otherwise
- unimportant. */
+ /* Create the idle thread. */
struct semaphore idle_started;
sema_init (&idle_started, 0);
- thread_create ("idle", PRI_MAX, idle, &idle_started);
+ thread_create ("idle", PRI_MIN, idle, &idle_started);
/* Start preemptive thread scheduling. */
intr_enable ();
See [IA32-v2a] "HLT", [IA32-v2b] "STI", and [IA32-v3a]
7.11.1 "HLT Instruction". */
- asm ("sti; hlt");
+ asm volatile ("sti; hlt" : : : "memory");
}
}