PKUOS - Pintos
Pintos source browser for PKU Operating System course
priority-change.c
Go to the documentation of this file.
1/** Verifies that lowering a thread's priority so that it is no
2 longer the highest-priority thread in the system causes it to
3 yield immediately. */
4
5#include <stdio.h>
7#include "threads/init.h"
8#include "threads/thread.h"
9
11
12void
14{
15 /* This test does not work with the MLFQS. */
17
18 msg ("Creating a high-priority thread 2.");
20 msg ("Thread 2 should have just lowered its priority.");
22 msg ("Thread 2 should have just exited.");
23}
24
25static void
27{
28 msg ("Thread 2 now lowering priority.");
30 msg ("Thread 2 exiting.");
31}
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
Definition: debug.h:31
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
Definition: debug.h:7
void msg(const char *format,...)
Definition: lib.c:28
static thread_func changing_thread
Verifies that lowering a thread's priority so that it is no longer the highest-priority thread in the...
void test_priority_change(void)
#define NULL
Definition: stddef.h:4
bool thread_mlfqs
If false (default), use round-robin scheduler.
Definition: thread.c:60
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...
Definition: thread.c:166
void thread_set_priority(int new_priority)
Sets the current thread's priority to NEW_PRIORITY.
Definition: thread.c:336
#define PRI_DEFAULT
Default priority.
Definition: thread.h:24
void thread_func(void *aux)
Definition: thread.h:116