+void schedule_tail (struct thread *prev);
+
+void
+schedule_tail (struct thread *prev)
+{
+ struct thread *cur = thread_current ();
+
+#ifdef USERPROG
+ addrspace_activate (&cur->addrspace);
+#endif
+
+ if (prev != NULL && prev->status == THREAD_DYING)
+ thread_destroy (prev);
+
+ intr_enable ();
+}
+