1#ifndef THREADS_THREAD_H
2#define THREADS_THREAD_H
20#define TID_ERROR ((tid_t) -1)
A kernel thread or user process.
uint8_t * stack
Saved stack pointer.
struct list_elem allelem
List element for all threads list.
unsigned magic
Detects stack overflow.
struct list_elem elem
List element.
char name[16]
Name (for debugging purposes).
tid_t tid
Thread identifier.
enum thread_status status
Thread state.
struct thread * thread_current(void)
Returns the running thread.
void thread_start(void)
Starts preemptive thread scheduling by enabling interrupts.
int thread_get_nice(void)
Returns the current thread's nice value.
void thread_foreach(thread_action_func *, void *)
Invoke function 'func' on all threads, passing along 'aux'.
bool thread_mlfqs
If false (default), use round-robin scheduler.
thread_status
States in a thread's life cycle.
@ THREAD_BLOCKED
Waiting for an event to trigger.
@ THREAD_DYING
About to be destroyed.
@ THREAD_RUNNING
Running thread.
@ THREAD_READY
Not running but ready to run.
void thread_action_func(struct thread *t, void *aux)
Performs some operation on thread t, given auxiliary data AUX.
void thread_unblock(struct thread *)
Transitions a blocked thread T to the ready-to-run state.
int thread_get_priority(void)
Returns the current thread's priority.
int tid_t
Thread identifier type.
const char * thread_name(void)
Returns the name of the running thread.
int thread_get_recent_cpu(void)
Returns 100 times the current thread's recent_cpu value.
void thread_tick(void)
Called by the timer interrupt handler at each timer tick.
void thread_yield(void)
Yields the CPU.
void thread_set_nice(int)
tid_t thread_create(const char *name, int priority, thread_func *, void *)
Creates a new kernel thread named NAME with the given initial PRIORITY, which executes FUNCTION passi...
tid_t thread_tid(void)
Returns the running thread's tid.
void thread_set_priority(int)
Sets the current thread's priority to NEW_PRIORITY.
void thread_block(void)
Puts the current thread to sleep.
void thread_func(void *aux)
int thread_get_load_avg(void)
threads/thread.h
void thread_print_stats(void)
Prints thread statistics.
void thread_exit(void) NO_RETURN
Deschedules the current thread and destroys it.