25 for (i = 0; i < 10; i++)
33 for (i = 0; i < 10; i++)
36 msg (
"Back in main thread.");
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
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_priority_sema(void)
static thread_func priority_sema_thread
Tests that the highest-priority thread waiting on a semaphore is the first to wake up.
static struct semaphore sema
void sema_init(struct semaphore *sema, unsigned value)
This file is derived from source code for the Nachos instructional operating system.
void sema_up(struct semaphore *sema)
Up or "V" operation on a semaphore.
void sema_down(struct semaphore *sema)
Down or "P" operation on a semaphore.
bool thread_mlfqs
If false (default), use round-robin scheduler.
const char * thread_name(void)
Returns the name of the running thread.
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_priority(int new_priority)
Sets the current thread's priority to NEW_PRIORITY.
#define PRI_DEFAULT
Default priority.
void thread_func(void *aux)
#define PRI_MIN
Thread priorities.