45 msg (
"%d threads will iterate %d times in the same order each time.",
47 msg (
"If the order varies then there is a bug.");
71 for (; output <
op; output++)
78 printf (
"(priority-fifo) iteration:");
95 *(*data->
op)++ = data->
id;
#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...
int printf(const char *format,...)
Writes formatted output to the console.
void msg(const char *format,...)
void * malloc(size_t size)
Obtains and returns a new block of at least SIZE bytes.
static thread_func simple_thread_func
void test_priority_fifo(void)
struct thread * holder
Thread holding lock (for debugging).
Creates several threads all at the same priority and ensures that they consistently run in the same r...
int ** op
Output buffer position.
int iterations
Iterations so far.
struct lock * lock
Lock on output.
void lock_release(struct lock *lock)
Releases LOCK, which must be owned by the current thread.
void lock_init(struct lock *lock)
Initializes LOCK.
void lock_acquire(struct lock *lock)
Acquires LOCK, sleeping until it becomes available if necessary.
bool thread_mlfqs
If false (default), use round-robin scheduler.
int thread_get_priority(void)
Returns the current thread's priority.
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.
void thread_yield(void)
Yields the CPU.
#define PRI_DEFAULT
Default priority.
void thread_func(void *aux)