member, restores the new thread's @code{stack} into the CPU's stack
pointer, restores registers from the stack, and returns.
-The rest of the scheduler is implemented in @func{schedule_tail}. It
+The rest of the scheduler is implemented in @func{thread_schedule_tail}. It
marks the new thread as running. If the thread we just switched from
is in the dying state, then it also frees the page that contained the
dying thread's @struct{thread} and stack. These couldn't be freed
arguments on the stack and the 80@var{x}86 SVR4 calling convention
requires the caller, not the called function, to remove them when the
call is complete. See @bibref{SysV-i386} chapter 3 for details.}
-calls @func{schedule_tail} (this special case is why
-@func{schedule_tail} is separate from @func{schedule}), and returns.
+calls @func{thread_schedule_tail} (this special case is why
+@func{thread_schedule_tail} is separate from @func{schedule}), and returns.
We fill in its stack frame so that it returns into
@func{kernel_thread}, a function in @file{threads/thread.c}.
lock_console()
vprintf()
- printf() - palloc() tries to grab the lock again
+ printf() - palloc() tries to grab the lock again
palloc_free()
- schedule_tail() - another thread dying as we switch threads
+ thread_schedule_tail() - another thread dying as we switch threads
schedule()
thread_yield()
- intr_handler() - timer interrupt
+ intr_handler() - timer interrupt
intr_set_level()
serial_putc()
putchar_have_lock()
putbuf()
- sys_write() - one process writing to the console
+ sys_write() - one process writing to the console
syscall_handler()
intr_handler()
# Discard switch_threads() arguments.
addl $8, %esp
- # Call schedule_tail(prev).
+ # Call thread_schedule_tail(prev).
pushl %eax
-.globl schedule_tail
- call schedule_tail
+.globl thread_schedule_tail
+ call thread_schedule_tail
addl $4, %esp
# Start thread proper.
static bool is_thread (struct thread *) UNUSED;
static void *alloc_frame (struct thread *, size_t size);
static void schedule (void);
-void schedule_tail (struct thread *prev);
+void thread_schedule_tail (struct thread *prev);
static tid_t allocate_tid (void);
/* Initializes the threading system by transforming the code
/* Remove thread from all threads list, set our status to dying,
and schedule another process. That process will destroy us
- when it call schedule_tail(). */
+ when it calls thread_schedule_tail(). */
intr_disable ();
list_remove (&thread_current()->allelem);
thread_current ()->status = THREAD_DYING;
After this function and its caller returns, the thread switch
is complete. */
void
-schedule_tail (struct thread *prev)
+thread_schedule_tail (struct thread *prev)
{
struct thread *cur = running_thread ();
running to some other state. This function finds another
thread to run and switches to it.
- It's not safe to call printf() until schedule_tail() has
- completed. */
+ It's not safe to call printf() until thread_schedule_tail()
+ has completed. */
static void
schedule (void)
{
if (cur != next)
prev = switch_threads (cur, next);
- schedule_tail (prev);
+ thread_schedule_tail (prev);
}
/* Returns a tid to use for a new thread. */
not in use, so we can always use that. Thus, when the
scheduler switches threads, it also changes the TSS's
stack pointer to point to the new thread's kernel stack.
- (The call is in schedule_tail() in thread.c.)
+ (The call is in thread_schedule_tail() in thread.c.)
See [IA32-v3a] 6.2.1 "Task-State Segment (TSS)" for a
description of the TSS. See [IA32-v3a] 5.12.1 "Exception- or