+/* Idle thread. */
+static struct thread *idle_thread; /* Thread. */
+static void idle (void *aux UNUSED); /* Thread function. */
+
+/* Stack frame for kernel_thread(). */
+struct kernel_thread_frame
+ {
+ void *eip; /* Return address. */
+ void (*function) (void *); /* Function to call. */
+ void *aux; /* Auxiliary data for function. */
+ };
+
+static void kernel_thread (void (*function) (void *aux), void *aux);
+
+static struct thread *next_thread_to_run (void);
+static struct thread *new_thread (const char *name);
+static bool is_thread (struct thread *t);
+static void *alloc_frame (struct thread *t, size_t size);
+static void destroy_thread (struct thread *t);
+static void schedule (void);
+void schedule_tail (struct thread *prev);
+
+/* Initializes the threading system. After calling, create some
+ threads with thread_create() or thread_execute(), then start
+ the scheduler with thread_start(). */