28static void test_mlfqs_fair (
int thread_cnt,
int nice_min,
int nice_step);
54#define MAX_THREAD_CNT 20
77 ASSERT (nice_min + nice_step * (thread_cnt - 1) <= 20);
82 msg (
"Starting %d threads...", thread_cnt);
84 for (i = 0; i < thread_cnt; i++)
100 msg (
"Sleeping 40 seconds to let threads run, please wait...");
103 for (i = 0; i < thread_cnt; i++)
120 if (cur_time != last_time)
122 last_time = cur_time;
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
int snprintf(char *buffer, size_t buf_size, const char *format,...)
Like printf(), except that output is stored into BUFFER, which must have space for BUF_SIZE character...
void msg(const char *format,...)
void test_mlfqs_nice_10(void)
void test_mlfqs_fair_20(void)
void test_mlfqs_fair_2(void)
static void test_mlfqs_fair(int thread_cnt, int nice_min, int nice_step)
Measures the correctness of the "nice" implementation.
static void load_thread(void *aux)
void test_mlfqs_nice_2(void)
static int64_t start_time
Starts 60 threads that each sleep for 10 seconds, then spin in a tight loop for 60 seconds,...
signed long long int int64_t
bool thread_mlfqs
If false (default), use round-robin scheduler.
tid_t thread_create(const char *name, int priority, thread_func *function, void *aux)
Creates a new kernel thread named NAME with the given initial PRIORITY, which executes FUNCTION passi...
void thread_set_nice(int nice UNUSED)
Sets the current thread's nice value to NICE.
#define PRI_DEFAULT
Default priority.
int64_t timer_ticks(void)
Returns the number of timer ticks since the OS booted.
int64_t timer_elapsed(int64_t then)
Returns the number of timer ticks elapsed since THEN, which should be a value once returned by timer_...
void timer_sleep(int64_t ticks)
Sleeps for approximately TICKS timer ticks.
#define TIMER_FREQ
Number of timer interrupts per second.