CS350 COS
COS
|
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <sys/syscall.h>
#include <sys/kassert.h>
#include <sys/kconfig.h>
#include <sys/kdebug.h>
#include <sys/kmem.h>
#include <sys/ktime.h>
#include <sys/mp.h>
#include <sys/spinlock.h>
#include <sys/thread.h>
#include <machine/trap.h>
#include <machine/pmap.h>
Go to the source code of this file.
Functions | |
Thread * | Sched_Current () |
void | Sched_SetRunnable (Thread *thr) |
void | Sched_SetWaiting (Thread *thr) |
void | Sched_SetZombie (Thread *thr) |
static void | Sched_Switch (Thread *oldthr, Thread *newthr) |
void | Sched_Scheduler () |
Variables | |
Spinlock | schedLock |
ThreadQueue | waitQueue |
ThreadQueue | runnableQueue |
Thread * | curProc [MAX_CPUS] |
Thread * Sched_Current | ( | ) |
Get the currently executing thread. This function retains a reference count and you must release the reference by calling Thread_Release.
Definition at line 56 of file sched.c.
void Sched_Scheduler | ( | ) |
Sched_Scheduler –
Run our round robin scheduler to find the process and switch to it.
Definition at line 189 of file sched.c.
void Sched_SetRunnable | ( | Thread * | thr | ) |
Sched_SetRunnable –
Set the thread to the runnable state and move it from the wait queue if necessary to the runnable queue.
[in] | thr | Thread to be set as runnable. |
Definition at line 77 of file sched.c.
void Sched_SetWaiting | ( | Thread * | thr | ) |
Sched_SetWaiting –
Set the thread to the waiting state and move it to the wait queue. The thread should be currently running.
[in] | thr | Thread to be set as waiting. |
Definition at line 104 of file sched.c.
void Sched_SetZombie | ( | Thread * | thr | ) |
Sched_SetZombie –
Set the thread to the zombie state and move it to the parent processes's zombie process queue. The thread should be currently running.
[in] | thr | Thread to be set as zombie. |
Definition at line 126 of file sched.c.
Sched_Switch –
Switch between threads. During the creation of kernel threads (and by proxy user threads) we may not return through this code path and thus the kernel thread initialization function must release the scheduler lock.
[in] | oldthr | Current thread we are switching from. |
[in] | newthr | Thread to switch to. |
Definition at line 175 of file sched.c.