12#define curthread (curcpu()->thread)
13#define curproc (curthread->owner)
void sched_init_spawn(struct proc *init)
Starts the scheduler with the first process, init, and runs it.
void sched_idle_wakeup(void)
Runs a ready thread now if an interrupt made one ready while this CPU was idle, rather than at the ne...
void sched_cpu_tick(uint32_t period, int user)
Charges a timer tick to the process that was running on this CPU.
void sched_alarm_get(struct proc *proc, uint64_t *value, uint64_t *interval)
Reads what is left of a process's real time timer.
void sched_thread_killed(void)
Ends the current thread, which was killed while it ran on this CPU (thread->killed).
int sched_wait(struct waitq *waitq, uint64_t until)
Puts the current thread to sleep on a wait queue until it is woken up, a signal ends the sleep,...
void sched_timer_cancel(struct thread *thread)
Takes a thread off the list of threads waiting with a deadline, when it no longer waits (it was woken...
void sched_alarm(struct proc *proc, uint64_t value, uint64_t interval, uint64_t *old_value, uint64_t *old_interval)
Sets a process's real time timer, which setitimer() and alarm() use: the process gets SIGALRM once va...
int sched_sleep(uint64_t until)
Puts the current thread to sleep until a time comes, for nanosleep().
void kernel_idle(void)
Gives up the CPU when the current thread can't run anymore (it sleeps, or it exited): the next ready ...
void scheduler_init(void)
void schedule(void)
Switches to the next ready thread.
void sched_timer_tick(uint32_t period, int user)
Runs the boot CPU's timer tick.
struct cpu * sched_thread_cpu(struct thread *thread)
Finds the CPU that is running a thread, if it's another CPU than this one.
void sched_thread_kick(struct thread *thread)
Makes a thread that runs on another CPU enter the kernel now, rather than at its next tick: a signal ...
void sched_thread_ready(struct thread *thread)
Puts a thread at the end of the ready list, to run in its turn.
void sched_thread_spawn(struct thread *thread)
Starts running a thread for the first time.
void sched_thread_wake(struct thread *thread)
Makes a thread that was sleeping ready to run.
unsigned long long int uint64_t
A processor, and what runs on it.