#include <debug.h>
#include <list.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | thread |
Defines | |
#define | TID_ERROR ((tid_t) -1) |
#define | PRI_MIN 0 |
#define | PRI_DEFAULT 31 |
#define | PRI_MAX 63 |
Typedefs | |
typedef int | tid_t |
typedef void | thread_func (void *aux) |
typedef void | thread_action_func (struct thread *t, void *aux) |
Enumerations | |
enum | thread_status { THREAD_RUNNING, THREAD_READY, THREAD_BLOCKED, THREAD_DYING } |
Functions | |
void | thread_init (void) |
void | thread_start (void) |
void | thread_tick (void) |
void | thread_print_stats (void) |
tid_t | thread_create (const char *name, int priority, thread_func *, void *) |
void | thread_block (void) |
void | thread_unblock (struct thread *) |
struct thread * | thread_current (void) |
tid_t | thread_tid (void) |
const char * | thread_name (void) |
void | thread_exit (void) NO_RETURN |
void | thread_yield (void) |
void | thread_foreach (thread_action_func *, void *) |
int | thread_get_priority (void) |
void | thread_set_priority (int) |
int | thread_get_nice (void) |
void | thread_set_nice (int) |
int | thread_get_recent_cpu (void) |
int | thread_get_load_avg (void) |
Variables | |
bool | thread_mlfqs |
#define PRI_DEFAULT 31 |
Definition at line 25 of file thread.h.
Referenced by changing_thread(), is_thread(), medium_thread_func(), process_execute(), sema_self_test(), test_alarm_priority(), test_mlfqs_block(), test_mlfqs_fair(), test_mlfqs_load_60(), test_mlfqs_load_avg(), test_priority_change(), test_priority_condvar(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), test_priority_donate_sema(), test_priority_fifo(), test_priority_preempt(), test_priority_sema(), and test_sleep().
#define PRI_MAX 63 |
#define PRI_MIN 0 |
Definition at line 24 of file thread.h.
Referenced by init_thread(), test_alarm_priority(), test_priority_condvar(), test_priority_donate_chain(), test_priority_sema(), and thread_start().
#define TID_ERROR ((tid_t) -1) |
typedef void thread_action_func(struct thread *t, void *aux) |
typedef void thread_func(void *aux) |
enum thread_status |
void thread_block | ( | void | ) |
Definition at line 223 of file thread.c.
References ASSERT, intr_context(), intr_get_level(), INTR_OFF, schedule(), thread::status, THREAD_BLOCKED, and thread_current().
Referenced by idle(), sema_down(), and wait().
tid_t thread_create | ( | const char * | name, | |
int | priority, | |||
thread_func * | , | |||
void * | ||||
) |
Definition at line 167 of file thread.c.
References alloc_frame(), allocate_tid(), ASSERT, kernel_thread_frame::aux, switch_threads_frame::ebp, switch_threads_frame::eip, switch_entry_frame::eip, kernel_thread_frame::eip, kernel_thread_frame::function, init_thread(), intr_disable(), intr_set_level(), kernel_thread(), NULL, PAL_ZERO, palloc_get_page(), switch_entry(), thread_unblock(), thread::tid, and TID_ERROR.
Referenced by process_execute(), sema_self_test(), test_alarm_priority(), test_mlfqs_block(), test_mlfqs_fair(), test_mlfqs_load_60(), test_mlfqs_load_avg(), test_priority_change(), test_priority_condvar(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), test_priority_donate_sema(), test_priority_fifo(), test_priority_preempt(), test_priority_sema(), test_sleep(), and thread_start().
struct thread* thread_current | ( | void | ) | [read] |
Definition at line 265 of file thread.c.
References ASSERT, is_thread(), running_thread(), thread::status, and THREAD_RUNNING.
Referenced by idle(), install_page(), load(), lock_acquire(), lock_held_by_current_thread(), lock_try_acquire(), print_stacktrace(), process_activate(), process_exit(), sema_down(), thread_block(), thread_exit(), thread_get_priority(), thread_name(), thread_set_priority(), thread_tick(), thread_tid(), thread_yield(), tss_update(), and wait().
void thread_exit | ( | void | ) |
Definition at line 290 of file thread.c.
References thread::allelem, ASSERT, intr_context(), intr_disable(), list_remove(), NOT_REACHED, process_exit(), schedule(), thread::status, thread_current(), and THREAD_DYING.
Referenced by kernel_thread(), kill(), main(), start_process(), and syscall_handler().
void thread_foreach | ( | thread_action_func * | , | |
void * | ||||
) |
Definition at line 329 of file thread.c.
References all_list, thread::allelem, ASSERT, intr_get_level(), INTR_OFF, list_begin(), list_end(), list_entry, and list_next().
Referenced by debug_backtrace_all().
int thread_get_load_avg | ( | void | ) |
Definition at line 374 of file thread.c.
Referenced by test_mlfqs_load_1(), test_mlfqs_load_60(), test_mlfqs_load_avg(), and test_mlfqs_recent_1().
int thread_get_priority | ( | void | ) |
Definition at line 352 of file thread.c.
References thread::priority, and thread_current().
Referenced by donor_thread_func(), medium_thread_func(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), test_priority_donate_sema(), test_priority_fifo(), and test_priority_preempt().
int thread_get_recent_cpu | ( | void | ) |
void thread_init | ( | void | ) |
Referenced by main().
const char* thread_name | ( | void | ) |
Definition at line 256 of file thread.c.
References thread::name, and thread_current().
Referenced by alarm_priority_thread(), donor_thread_func(), interloper_thread_func(), kill(), priority_condvar_thread(), priority_sema_thread(), simple_thread_func(), and test_priority_donate_chain().
void thread_print_stats | ( | void | ) |
Definition at line 145 of file thread.c.
References idle_ticks, kernel_ticks, printf(), and user_ticks.
Referenced by print_stats().
void thread_set_nice | ( | int | ) |
void thread_set_priority | ( | int | ) |
Definition at line 345 of file thread.c.
References thread::priority, and thread_current().
Referenced by changing_thread(), test_alarm_priority(), test_priority_change(), test_priority_condvar(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_fifo(), and test_priority_sema().
void thread_start | ( | void | ) |
Definition at line 107 of file thread.c.
References idle(), intr_enable(), PRI_MIN, sema_down(), sema_init(), and thread_create().
Referenced by main().
void thread_tick | ( | void | ) |
Definition at line 124 of file thread.c.
References idle_ticks, intr_yield_on_return(), kernel_ticks, NULL, thread_current(), thread_ticks, TIME_SLICE, and user_ticks.
Referenced by timer_interrupt().
tid_t thread_tid | ( | void | ) |
void thread_unblock | ( | struct thread * | ) |
Definition at line 241 of file thread.c.
References ASSERT, thread::elem, intr_disable(), intr_set_level(), is_thread(), list_push_back(), ready_list, thread::status, THREAD_BLOCKED, and THREAD_READY.
Referenced by sema_up(), signal(), and thread_create().
void thread_yield | ( | void | ) |
Definition at line 311 of file thread.c.
References ASSERT, thread::elem, intr_context(), intr_disable(), intr_set_level(), list_push_back(), ready_list, schedule(), thread::status, thread_current(), and THREAD_READY.
Referenced by intr_handler(), medium_thread_func(), simple_thread_func(), sleeper(), test_priority_donate_nest(), and timer_sleep().
bool thread_mlfqs |
Definition at line 61 of file thread.c.
Referenced by parse_options(), test_alarm_priority(), test_mlfqs_block(), test_mlfqs_fair(), test_mlfqs_load_1(), test_mlfqs_load_60(), test_mlfqs_load_avg(), test_mlfqs_recent_1(), test_priority_change(), test_priority_condvar(), test_priority_donate_chain(), test_priority_donate_lower(), test_priority_donate_multiple(), test_priority_donate_multiple2(), test_priority_donate_nest(), test_priority_donate_one(), test_priority_donate_sema(), test_priority_fifo(), test_priority_preempt(), test_priority_sema(), and test_sleep().